delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/03/00:14:10

Sender: nate AT cartsys DOT com
Message-ID: <377D5835.F6345844@cartsys.com>
Date: Fri, 02 Jul 1999 17:24:21 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Someone please help with memory problem.
References: <377c0d74 DOT 8937482 AT nntp DOT ix DOT netcom DOT com> <930903379 DOT 294 AT www DOT remarq DOT com> <377cbbd7 DOT 42915343 AT nntp DOT ix DOT netcom DOT com>
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019