Jan Vroonhof <vroonhof(a)math.ethz.ch> writes:
Hrvoje Niksic <hniksic(a)iskon.hr> writes:
> It seems that our relocating allocator attempts to do what Doug Lea
> malloc() already does.
IIRC both our current collectors are older versions of the allocator
that Doug Lea's allocator replaced in libg++/glibc. Using the Doug
Lea version should normally be preferred I think..
It already is. AFAIK dlmalloc is used by default on Linux. The
change was made when minimal tagbits were created. That's why minimal
tagbits are chosen by default on Linux.
> The system-provided mmap-based allocation seems a better idea
in
> XEmacs because it's performed for *all* large allocations (large
> vectors, strings, frob blocks etc.) rather than only for buffers,
> as our ralloc does.
Shouldn't we be using ralloc for frob blocks anyway?
It is my understanding that there are safety issues which make ralloc
unsafe for anything but buffer text. But these issues might be
restricted to non-mmap version of the allocator. I don't know.
> Does this mean we ought to turn off relalloc on Linux for 21.2?
I don't know. My problem would be the fact that the triggering is
based on allocation size..
Yes, and that's a feature. mmap()-based allocation would be way too
slow for small allocations.
What happens if you alloc+free
- 1000, 1K strings
- 1000, 1k buffers
- 1 MB worth of cons cells.
1000 1k buffers is probably contrived. However, 1000 1k strings would
be relocated by the compactor, and the cons cells would be allocated
in frob blocks. Which means the memory will be released after GC.
But why not test it?
1) Evaluate:
;; 100,000 cons-cells is about 1M
(prog1 nil (setq a (make-list 100000 ?a)))
2) Evaluate:
(setq a nil)
(garbage-collect)
The sizes are:
8876 5656
(1)
9956 6748
(2)
8932 5728
Apparently the memory is reclaimed.
The string test has failed, and I don't think I can really explain it.
If I read alloc.c correctly, strings smaller than 8K should be "small
strings", and all of these are supposed to fit that category. It
seems they were nevertheless exempt from compacting/freeing. No idea
why.
The biggest problem with frob blocks in our GC is that no relocation
or compacting is done. This means that if only one cons-cell in a
frob block remains in use, the whole frob block can't be freed. This
was not the case in your example.
I am not sure either the current system or dlmalloc works in this
case.
It seems to.
Along the same lines I have been wondering whether the frobblock
size shouldn't be upped?
How much is it now? 1000 conses? The no-relocation problem described
above makes me uneasy about making it larger.