summaryrefslogtreecommitdiffstats
path: root/mbbsd/pmore.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-05-27 22:08:38 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-05-27 22:08:38 +0800
commit6b957f167e59782f2342e692ac1fd749e2adf025 (patch)
treee31260435f615442ed7245e183d1cd518bdb40af /mbbsd/pmore.c
parent87ec87b5f570eeebb4b699140838ecd484ef8c1a (diff)
downloadpttbbs-6b957f167e59782f2342e692ac1fd749e2adf025.tar
pttbbs-6b957f167e59782f2342e692ac1fd749e2adf025.tar.gz
pttbbs-6b957f167e59782f2342e692ac1fd749e2adf025.tar.bz2
pttbbs-6b957f167e59782f2342e692ac1fd749e2adf025.tar.lz
pttbbs-6b957f167e59782f2342e692ac1fd749e2adf025.tar.xz
pttbbs-6b957f167e59782f2342e692ac1fd749e2adf025.tar.zst
pttbbs-6b957f167e59782f2342e692ac1fd749e2adf025.zip
* hack dietlibc's allocator. release small block to OS.
* allocation behavior dirty hack for dietlibc. Avoid allocate 64byte slot, use 128byte slot instead. Thus, they share same memory block. * save about 400mb for ptt. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3519 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/pmore.c')
-rw-r--r--mbbsd/pmore.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c
index 26f73a38..dd22ed60 100644
--- a/mbbsd/pmore.c
+++ b/mbbsd/pmore.c
@@ -809,7 +809,16 @@ mf_parseHeaders()
// p is pointing at a new line. (\n)
l = (int)(p - pb);
+#ifdef CRITICAL_MEMORY
+ // kcwu: dirty hack, avoid 64byte slot. use 128byte slot instead.
+ if (l<100) {
+ p = (unsigned char*) malloc (100+1);
+ } else {
+ p = (unsigned char*) malloc (l+1);
+ }
+#else
p = (unsigned char*) malloc (l+1);
+#endif
fh.headers[i] = p;
memcpy(p, pb, l);
p[l] = 0;