Mail Archives: djgpp/1999/06/03/02:42:26
On Wed, 2 Jun 1999, Anton Helm wrote:
> 1) The program works fine when buildt with DJGPP v2.01
> 2) When buildt with v2.02 I get a seg-fault in
> malloc+349
>
> I know this looks very much like a memory problem
> (either allocated not enough memory somewhere or freed twice ...).
>
> 3) I used MSS v1.2 to build a testversion of the program.
> Setting the MSS options to "paranoid" (well, you know ...)
> I sent the program to the remote user and asked him to mail me the
> MSS logfile. The testversion of the program worked there without ANY
> problem. It produced a rather big logfile which I searched carefully.
> No warnings or errors in this file.
Several things come to mind:
1) Try YAMD instead of MSS. (This will only work if the program runs
in plain DOS on the target machine.)
2) Use the `_CRT0_FLAG_FILL_SBRK_MEMORY' bit in
`_crt0_startup_flags', and see what happens. Perhaps the program
uses uninitialized memory somewhere.
3) Find out exactly where in malloc does it crash, then introduce a
small change there to print the buffer around the faulty
pointer. Perhaps looking at the values will give a hint (e.g.,
if it looks like ASCII text, you could look for places where
this text might have come from).
(I said "a small change" because a large one might work like MSS,
and make the problem mysteriously go away.)
- Raw text -