[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Hybird GC issues in lua 5.4
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 22 Dec 2020 16:51:45 -0300
> 3. We use generational mode at start, run some minor/young cycles, and
> when the total memory increased to a threshold value, we switch it to
> incremental mode, and switch back after a full cycle (It goes through
> a number of steps).
> They works fine except enterinc(). When switching from generational to
> incremental , it stop-the-world about 100ms~400ms / 1GB memory.
> I guess the reason is `whitelist(g, g->allgc)`. It traverses all the
> object. Is it possible to improved this in future ? I think it's not
> very diffcult, we can add a stage something like GCSenterinc before
This seems doable; Lua could white this list incrementally, too.
Certainly these transitions between modes could be improved.
> Another issue is about the memory layout of TString.
> I think using a pointer to hold the string data would be better the
> putting the data into a continuous TString structure.
> Although an additonal pointer would waste 4/8 bytes memory, but
> TString object can be a small fixed size object. It's more
> cache-friendly to GC , and many general purpose allocator could manage
> small objects more efficiently.
Besides this fixed-size headers, the allocator still would have
to deal with the variable-size contents. And the waste would
probably be larger than 4/8 bytes, because each extra memory block
aslo wastes some bytes in its header. Or not?