AllocPP.pl is a script I authored that creates a dynamic heap (as in datatype heap, not the heap segment of the process) in your program, and these heaps are allocatable, and reallocatable, and deallocatable. It does so by preprocessing your program. It’s in no way a substitution for memory management and garbage collection, but you can use it for one-off programs and tests. It has two directives, ‘#alloc’ and ‘#hashfunc’. The latter is not important, just name your hash function anything. But the former is important. There can be as many heaps in your programs as possible.

There’s an example, and full explanation in the Gist.

Thanks.