Mail Archives: djgpp/2000/11/10/18:33:38
> From: dcasale AT my-deja DOT com
> Newsgroups: comp.os.msdos.djgpp
> Date: Fri, 10 Nov 2000 21:07:40 GMT
>
> Here's an update on the situation, though. I was able to get my
> compression program working with Nate Eldredge's YAMD (Yet Another
> Malloc Debugger). My program has a loop which allocates some bytes,
> allocates some more bytes, then deallocates both. The loop executes
> without any trouble several times, then fails on an allocation.
What do you mean by ``fails''? Did it crash with a Page Fault? If
so, the place where it crashed is the code which overwrites an
allocated buffer, and you should look closely at the code which
crashed.
The way YAMD works, it causes a Page Fault whenever a program tries to
access any address outside of any buffer allocated via malloc.
> Any ideas why that would happen? Is there a DJGPP equivalent to the
> Microsoft _fheapmin call that I don't know about, that might solve this
> problem?
What do you need the equivalent of _fheapmin for? How would it help
to solve this problem?
> I'll post a snippet from YAMD's symify'ed log file if you'd like, but
> it's kind of large.
If the program's run ends with a Page Fault and a crash, look at the
spot where it crashed. If there's no Page Fault, it's useless to post
the log file here, because no one will be able to interpret it without
knowing a lot about your program.
> One of the things that I noticed was that it
> wasn't malloc'ing in the same spot. One time it would malloc at
> 0x272eff4 and 0x2732fd8 (and deallocate them both properly). The next
> time it would malloc at 0x2736ff4 and 0x273afd8 (again, deallocating
> them both properly). There's nothing else in between these two
> allocations and deallocations in the log file, either, and they both
> happen to be 12 bytes and 40 bytes. So why didn't the malloc's happen
> in the same spot?
Perhaps malloc couldn't merge the small allocations back into a larger
block, before the other allocation comes. Or maybe the smaller
allocation belongs to another bucket.
In any case, I wouldn't worry about this, I don't think your problem
is due to some bug in malloc.
- Raw text -