Overloading new / malloc, free, etc. with user-defined heaps
Posted on 1997-04-29
Hi, I'm looking for info on how to overload new() (or malloc, for that
matter) so it takes memory from a user-defined block of memory instead
of the heap.
For example, if I have a 16MB chunk of memory which has already been
allocated, I would like to use new, malloc, delete, free, etc. so that
they can use this block of memory instead of the heap. Also, I'd like
other functions that get memory (like string functions) to use this
ptr = new (my_type, &my_heap);
I basically need it to handle memory in a user-defined block, so garbage
collection is a good idea (re-aligning spaces to use contiguous memory
and get rid of holes).