delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/03/17:11:47

Sender: nate AT cartsys DOT com
Message-ID: <36670B87.C7094075@cartsys.com>
Date: Thu, 03 Dec 1998 14:07:03 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com, buzrla AT merkur DOT econ DOT muni DOT cz
Subject: Re: malloc problem
References: <Pine DOT LNX DOT 3 DOT 96 DOT 981203154441 DOT 2099A-100000 AT merkur DOT econ DOT muni DOT cz>
Reply-To: djgpp AT delorie DOT com

Jan Buzrla wrote:
> 
> Hi,
> I'm new to this group, so I don't know if this problem has been discused
> here before. Some of my programs in DJGPP crashes with SIGSEGV and the
> symify program says, that it's the malloc function which caused the
> exeption. I tried CWSDPMI release 3 and 4, tried to run it under W95, but
> it's still the same. It seems not to be in number of allocations nor in
> size of requested blocks of memory.
> 
> For example: One of my programs proceses the datafile and allocates small
> blocks of memory. When it has crashed, I changed the size of datafile and
> everything was OK.
> 
> Thanks for any advice.

It could easily be due to a bug in your program.  `malloc' keeps a lot
of its own data along with the blocks it gives you, and if you go beyond
the bounds of those blocks, you may overwrite it.  Since a lot of that
is pointers, `malloc' may crash next time it tries to use that data. 
The BSD malloc algorithm used in DJGPP 2.01 has been around for a long
time and is very stable, so it's unlikely there's a bug in it.

For catching bugs of this type, several malloc debugging libraries
exist.  MSS and Fortify are two that people have reported to be
helpful.  (I haven't used either seriously.)

> Reply to e-mail, please.

This is inconvenient for many people; you will probably have more
success if you can arrange to read the group.  It exists as a mailing
list as well as a newsgroup.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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