It turns out it is a quite small modification, and works pretty well: http://trac.osgeo.org/geos/attachment/ticket/208/memdiff.patch
My patch adds the ability to override, and also has some printfs to show what is happening. When the overridden allocator is called without the runtime callback set, it prints "std alloc" and when it's called with the callback set, it prints "geos alloc". Here's a little program that exercises it: #include <stdio.h> #include "/usr/local/include/geos_c.h" #include <stdlib.h> int main() { printf("main\n"); GEOSCoordSequence* cs; GEOSGeometry* g; int r; printf("initgeos\n"); initGEOSMemory(malloc, free); printf("coordseqcreate\n"); cs = GEOSCoordSeq_create(1, 2); printf("coordseqsetx\n"); r = GEOSCoordSeq_setX(cs, 0, 1.0); printf("coordseqsety\n"); r = GEOSCoordSeq_setY(cs, 0, 1.0); printf("createpoint\n"); g = GEOSGeom_createPoint(cs); return 0; } And here is the output: Heron:tmp pramsey$ ./a.out std alloc! std alloc! main initgeos coordseqcreate geos alloc! geos alloc! geos alloc! coordseqsetx coordseqsety createpoint geos alloc! So, something in C++ is doing a couple allocations before we can slip in and get our other function in place. But we can get all the big stuff caught no problem. P. _______________________________________________ geos-devel mailing list geos-devel@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/geos-devel