Mail Archives: djgpp/2019/06/17/13:12:29
> From: "J.W. Jagersma (jwjagersma AT gmail DOT com) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
> Date: Mon, 17 Jun 2019 18:46:24 +0200
>
> > Right. There's a startup flag that a program could optionally set to
> > request that allocated memory be filled with a specific fixed value,
> > then tests for clobbering could work. See the documentation of
> > _crt0_startup_flags in the libc manual.
> >
>
> If the issue is caused by the dpmi host or sbrk(), then I think enabling
> the _CRT0_FLAG_FILL_SBRK_MEMORY flag would mask this bug.
How can it? sbrk cannot possibly cause this because your program
doesn't sound like one that would ever release sbrk'ed memory back to
the DPMI host. And malloc just fills the buffer it hands to you,
there's no effect of this flag on the address of that buffer.
> With this flag enabled, the test does complete successfully on
> cwsdpmi.
Which probably means your detection of "already allocated" is flawed
in some sense. All this flag does is wipe out any possible garbage in
the memory you get from malloc, left-overs from previous allocations;
the flag AFAIR has no other effects on the algorithms of malloc.
In general, at thus point in DJGPP's life cycle, I'd be hard-pressed
to believe we have such blatant bugs in memory allocation. I used to
run Emacs compiled with DJGPP for days on end without any memory
problems. Emacs is very memory-intensive program, so the DJGPP v2
libc gets a clean bill of health from me, as far as memory allocation
is concerned. It's always possible some bug has crept into the
library, but I'd suspect the application first and foremost.
- Raw text -