Mail Archives: djgpp/1998/12/03/17:11:47
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 -