Skip to content

Commit

Permalink
Merge pull request aerospike#127 from citrusleaf/CLIENT-675
Browse files Browse the repository at this point in the history
Use heap allocation for get_many requests > 20K records
  • Loading branch information
Jeff Boone committed Feb 17, 2016
2 parents 1b38c18 + 73c4cf2 commit 23a1389
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/main/client/get_many.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include "exceptions.h"
#include "policy.h"

#define MAX_STACK_ALLOCATION 20000

typedef struct {
PyObject * py_recs;
AerospikeClient * client;
Expand Down Expand Up @@ -244,7 +246,11 @@ static PyObject * batch_get_aerospike_batch_read(as_error *err, AerospikeClient
Py_ssize_t size = PyList_Size(py_keys);

py_recs = PyList_New(size);
as_batch_read_inita(&records, size);
if (size > MAX_STACK_ALLOCATION) {
as_batch_read_init(&records, size);
} else {
as_batch_read_inita(&records, size);
}

// Batch object initialised
batch_initialised = true;
Expand Down Expand Up @@ -272,7 +278,11 @@ static PyObject * batch_get_aerospike_batch_read(as_error *err, AerospikeClient
Py_ssize_t size = PyTuple_Size(py_keys);

py_recs = PyList_New(size);
as_batch_read_inita(&records, size);
if (size > MAX_STACK_ALLOCATION) {
as_batch_read_init(&records, size);
} else {
as_batch_read_inita(&records, size);
}
// Batch object initialised
batch_initialised = true;

Expand Down

0 comments on commit 23a1389

Please sign in to comment.