summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-12-11 14:07:51 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-12-11 14:07:51 +0100
commit9b8352d808afc9cd8a12c46b768ed7a3e0a68a9a (patch)
tree1696d698a7d7c2e81fbcd4e384500b50aec2d04a
parent42041973528e98bda4ff06791874dafa7fe8085d (diff)
capn-malloc: optionally use lower malloc size
-rw-r--r--src/lib/capnp-c/capn-malloc.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/capnp-c/capn-malloc.cc b/src/lib/capnp-c/capn-malloc.cc
index 8a6cd1c..79f08c8 100644
--- a/src/lib/capnp-c/capn-malloc.cc
+++ b/src/lib/capnp-c/capn-malloc.cc
@@ -43,11 +43,19 @@ struct check_segment_alignment {
static struct capn_segment *create(void *u, uint32_t id, int sz) {
struct capn_segment *s;
sz += sizeof(*s);
- if (sz < 4096) { // TODO auskommentieren?
+#if 0
+ if (sz < 1024) {
+ sz = 1024;
+ } else {
+ sz = (sz + 1023) & ~1023;
+ }
+#else
+ if (sz < 4096) {
sz = 4096;
} else {
sz = (sz + 4095) & ~4095;
}
+#endif
s = (struct capn_segment*) mpcalloc(1, sz);
s->data = (char*) (s+1);
s->cap = sz - sizeof(*s);