Subj : Re: malloc() To : borland.public.cpp.borlandcpp From : Dwayne Date : Wed Jun 23 2004 03:25 pm Hello Jan, Jan>>This is about an error and a lame solution.<< This may be a little incorrect for the *newer* versions of Borland, so maybe the experts out there can tell me if this is fixed.... When you allocate memory as such, and free it, It actually does not truly free the memory used when you allocated. When you Reallocate, the program checks each of your "freed" pointers. If there is enough space to use from a previous pointer that points to a continuous section of memory the size of your malloc, it will use it. If not, it will allocate some more memory on a different pointer. The result is your memory is fragmented. Soon it becomes so fragmented, that it cannot allocate a portion of memory large enough to have a continuous non fragmented piece of memory... and it fails. This was very common in the earlier versions of C/C++, I would have 50K of memory, attempt to allocate 5k and failure would occure. MemHeap took care of this problem for me. I am wondering if this may be what is happening to you... Just a thought.... Dwayne .