realloc + memory manager

Started by
0 comments, last by Austrian Coder 20 years, 8 months ago
Hello! I have written a memory manager. It works fine. But i have one problem. If the pool of memory is full, i want to extend it. Lets say, the memory manger allocates with the constr. 5 MB space. [CMemoryManager MemMng(5242880);] Now i have used all the free space. Now i want to extend it, without destroying the data of the smaller memory pool. Is realloc good for this? How make this?
Advertisement
Realloc may move all of your allocations and make all of your pointers invalid. The alternative is to maintain a list of pools or use a memory allocator that supports extending the pool without moving the the data (if one exists).
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!

This topic is closed to new replies.

Advertisement