I'm having trouble with dynamic memory allocation. Using VC (toolkit 2003) on XP and programming C (not C++), I'm using a lot of malloc/free function calls.
All went fine until today. At a certain point in the program, it crashes on the malloc() function. It doesn't really matter in what function malloc() is called or what specific pointer is being allocated... if I remove the malloc(), the program crashes on the next malloc(). And the same malloc() works fine in a previous call to the function containing the malloc/free functions...
I thought I had reached a memory limit, but when I decrease one of the first mallocs (which is always succesful) from about 500000 Bytes to 50000 bytes, the program still crashes at the same later malloc() (which only claims for about 500 bytes).
So I was wondering if there is a limit on the number of calls to malloc ? And how can this be avoided ?
What should I do ??