--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/fastmalloc.c Sat Aug 11 15:52:30 2007 +0200
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "dictre.h"
+
+static int given = 0;
+static int sysallocated = 0;
+static void *base = 0;
+
+enum {
+ STEP = 5*1024*1024
+};
+
+void * fastmalloc(int newsize)
+{
+ void *outptr;
+
+ outptr = base + given;
+
+ given += newsize;
+
+ if (given > sysallocated)
+ {
+ if (STEP > newsize)
+ {
+ base = realloc(base, STEP);
+ sysallocated += STEP;
+ }
+ else
+ {
+ base = realloc(base, newsize);
+ sysallocated += newsize;
+ }
+ }
+
+ return outptr;
+}