Re: LCCWIN ver WATCOM, BORLAND and interpreter
- Posted by Robert Craig <rds at RapidEuphoria.com> Oct 20, 2001
- 419 views
Euman writes: > ...Now you are actually free'ing the right address for iChild > > Why is it that Borland and the interpreter didnt catch this? Euphoria's free() calls C's free(). Euphoria's allocate() calls C's malloc(). Each C compiler implements malloc() and free() differently. I believe Watcom's free() just sets a bit saying "this block is free". Joining together of adjacent free blocks is done later when malloc() searches for a free block. So the crash may come much later in your program, if at all, and for no apparent reason. Other compilers do the joining together part immediately, during the free() itself. This makes it more likely that a crash will occur right away. If you are using only allocate() and free(), euphoria\include\safe.e can sometimes be used to catch the case where you free an address that you didn't allocate. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com