Mail Archives: djgpp-workers/2002/05/16/15:28:22
> From: sandmann AT clio DOT rice DOT edu
> Date: Thu, 16 May 2002 12:27:58 -0500 (CDT)
>
> Oh wait, EMACS does that dump thing, so unixy sbrk() will really be
> a requirement
I don't think so. The dumped executable starts its allocation anew
when it runs; the old heap is converted into .data and its free memory
chain forgotten. (Most allocations before dumping are done in the
.data segment anyway, by redirecting malloc to allocate off a special
static array instead of from the heap, so the heap itself is actually
very small when Emacs dumps itself.)
In addition, our library is unexec-safe, so no special precautions
should be needed for running the dumped Emacs. However, perhaps this
bug will show that I'm mistaken here...
I actually used Emacs built with the library malloc and the default
sbrk for some time during the early days of DJGPP v2.0 (that's why
it's so easy to switch), because the relocatable allocator caused a
hard-to-debug bug I described elsewhere in this thread. So I know it
works, or at least used to work, although the memory footprint grows
rather quickly (so don't think about running it for a month or so ;-).
> unless someone stops that
> insanity at least for initial dumps. :-) Since it has it's own malloc()
> it just might require unixy sbrk() anyway.
That happens automatically: you will see that src/msdos.c in the Emacs
sources notes when GNU malloc and relocatable allocator are used, and
sets the Unixy sbrk bit in _crt0_startup_flags. At the time I did the
DJGPP v2 port, I didn't believe the relocation code could cope with
non-contiguous DPMI memory madness, so I decided to play it safe. But
I never actually tested that, so who knows... (It looks like the
Emacs sources actually have code to deal with that.)
- Raw text -