Max limit on number of records that can be added in a Set

I am trying to add 100K records. But aerospike c client crashes after adding 65K + records. Not sure what is wrong in following code. Following is the pseudo code.

for (long l_lUserIndex = 0; l_lUserIndex <= 1000000; l_lUserIndex++) { memset(buffer, ‘\0’, 250); sprintf(buffer, “%ld”, l_lUserIndex);

strcpy(_key, “Index”); strcat(_key, buffer);

// Once user index reaches > 65500 as_record_inita crashes. as_key_init(&key, “AAA”, “Users”, _key); as_record_inita(&rec, 3); // Code for writing to aerospike


I replaced as_record_inita() by as_record_init() and crash stopped.


You may have figured but just to make it clear as_record_inita() creates space to store record before sending it over network in stack space. If you do that in loop you are running out of stack space.

as_record_init() uses heap.

– R