Mail Archives: djgpp/1999/07/03/00:14:10
Kevin P. Soucy wrote:
>
> On Fri, 02 Jul 1999 00:16:17 -0800, Clemens Valens
> <c DOT valens AT mindless DOT com> wrote:
>
> >My guess is that your problem is not in the code you
> >posted, but in the part you didn't post. I tried your code,
> >using new random values for block_cols and block_rows every
> >pass and it runs fine under real DOS and in a DOS box under
> >Windows 98. Maybe you mess up your variables somewhere else.
> >
> >Clemens
>
> Thanks. I thought I was using free incorrectly. BTW, why does DJGPP
> always crash when it tries to free memory that hasn't been allocated?
> (Or so I'm lead to believe. My program always crashes on the free
> functions for reasons I cannot explain.)
Why does your car engine stop working when you drill holes in it?
For speed, malloc and free assume that you've done everything
correctly. Should something be wrong, they tend to deal with it rather
gracelessly. As would your engine if unexpected holes were suddenly to
appear.
Freeing memory not allocated is one common way to crash free; another is
when you've written past the boundaries of a malloced buffer.
<plug>
You might try my YAMD package to help track down such bugs.
http://www.cartsys.com/eldredge/n/yamd/
</plug>
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -