Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: argv subscript range uses too many memory

On Nov 20,  9:05pm, Peter Stephenson wrote:
} Instead of optimising freeheap for the case where the are lots of
} heaps, could we just increase HEAPSIZE?  It's only 16384 (minus a
} header), which seems pretty small to me.

Note that HEAPSIZE is only the lower limit on the size of an arena.
The actual size will depend on the largest contiguous chunk requested
of zhalloc().  Which is a bit strange because all calls to zfree()
use the HEAPSIZE or HEAPFREE constants instead of h->size or perhaps
ARENA_SIZEOF(h).  It must really not matter to zfree().

In any case workers/29175 isn't really optimizing just for a lot of
heaps or even for a lot of allocated memory; it's optimizing for a
lot of calls to freeheap(), most of which don't really have anything
useful to do.  It's just that in Han Pingtian's example there IS
something useful to do, but the optimization skips doing it because
fheap has been advanced [by zhalloc()] to point only at the most
recently allocated block.

If you think of the heaps linked-list as proceeding left to right,
then with 29175 freeheap assumes fheap points somwhere in the middle
of the list, but zhalloc tends to move it too far to the right.  It
remains to be seen whether 30809 moves it too far back to the left
(that is, effectively reverses 29175).

Or ... I may have completely misinterpreted how freeheap is supposed
to do its work, and there's an entirely different optimization that
should be done in place of 29175.

Messages sorted by: Reverse Date, Date, Thread, Author