Commit 29050124 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Don't allocate a megabyte on the stack

git-svn-id: file:///svn/tokudb@472 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9fefe9b2
...@@ -77,7 +77,8 @@ void serialize_brtnode_to(int fd, diskoff off, diskoff size, BRTNODE node) { ...@@ -77,7 +77,8 @@ void serialize_brtnode_to(int fd, diskoff off, diskoff size, BRTNODE node) {
struct wbuf w; struct wbuf w;
int i; int i;
unsigned int calculated_size = serialize_brtnode_size(node); unsigned int calculated_size = serialize_brtnode_size(node);
char buf[size]; //char buf[size];
char *MALLOC_N(size,buf);
assert(size>0); assert(size>0);
wbuf_init(&w, buf, size); wbuf_init(&w, buf, size);
//printf("%s:%d serializing %lld w height=%d p0=%p\n", __FILE__, __LINE__, off, node->height, node->mdicts[0]); //printf("%s:%d serializing %lld w height=%d p0=%p\n", __FILE__, __LINE__, off, node->height, node->mdicts[0]);
...@@ -124,6 +125,7 @@ void serialize_brtnode_to(int fd, diskoff off, diskoff size, BRTNODE node) { ...@@ -124,6 +125,7 @@ void serialize_brtnode_to(int fd, diskoff off, diskoff size, BRTNODE node) {
//printf("%s:%d wrote %d bytes for %lld size=%lld\n", __FILE__, __LINE__, w.ndone, off, size); //printf("%s:%d wrote %d bytes for %lld size=%lld\n", __FILE__, __LINE__, w.ndone, off, size);
assert(w.ndone<=size); assert(w.ndone<=size);
toku_free(buf);
} }
int deserialize_brtnode_from (int fd, diskoff off, BRTNODE *brtnode, int nodesize) { int deserialize_brtnode_from (int fd, diskoff off, BRTNODE *brtnode, int nodesize) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment