How to add as_map to Large ordered list (llist)

Hi Raj,

Thanks for the details. This fix worked fine. But Ideally the original code should work.

I am using C client API through C++ code. I tried to find the root cause of this issue. Below are the details:

for(int k = 0; k < n; ++k) {
    as_hashmap map1;
    as_map *m1 = (as_map *)as_hashmap_init(&map1, (2));
    as_stringmap_set_str(m1, "key", map_array[k].key);
    as_stringmap_set_int64(m1, map_array[k].key, map_array[k].value);
    as_arraylist_append_map(&vals, m1);
}

In this for loop I printed the address of “m1” and found that it gets same address every time (for k = 0…n-1). It might be optimization from g++ compiler. In the as_arrarylist_append_map() call it just stores the address of as_val. So in my case there are multiple map entries in the as_arraylist but all of them having the same address and same content also (key and value for (n-1)th) entry. That’s why it gives Unique key or value violation error.

Why are your storing only the address ? why not value ?

If you have done it purposefully, then your documentation should mention that “use only heap allocated data types while storing the elements into arraylist”. Otherwise many users will face this issue.