TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A simple semi-space collector – wingolog (2022)

43 pointsby whereistimbo6 months ago

3 comments

davexunit6 months ago
If you like reading about GC implementation than keep reading wingo's blog. He's currently being funded by NLnet to finish the Whippet GC library.
评论 #42220566 未加载
vanderZwan6 months ago
Wingolog blog posts are always such a joy to read (for me at least). The combination of low-level fundamental stuff presented in a simple and accessible way that gets the core idea across is a rare quality.<p>An immediate question I have is whether one could extend compacting GCs to also &quot;sort&quot; or &quot;cluster&quot; the live objects for better cache access in some way (in a practical sense I mean, where the extra runtime overhead is worth it). Also what kind clustering would actually work in that case.<p>I&#x27;m guessing naively tracking how often each object is accessed in a certain window of time and sorting by that wouldn&#x27;t work, since the most accessed objects could be used at completely different times - some sort of &quot;accessed together&quot; algorithm probably makes more sense. But then we&#x27;re in the territory of a combinatorial explosion of options if we&#x27;re not careful.<p>Maybe something really stupid would work:<p><pre><code> 1. use a single global integer that increases by one with each heap memory access, 2. assign the counter&#x27;s value to GC metadata of the accessed object in question as a sort of &quot;time stamp&quot; 3. during compacting, &quot;sort&quot; all living objects by whatever they have as their value (this is probably really hard) 4. after compacting, reset counter and time stamps </code></pre> Worst case this would put objects right next to at least two objects that were accessed around the same time.<p>I presume that this question must have been researched to death, does anyone have any suggestions?
ogogmad6 months ago
This approach makes sense if you have access to either all available memory or a fixed quantity of memory, half of which would go to the fromspace and the other half to the tospace. What I don&#x27;t understand is: When should the heap be made bigger? What about smaller?
评论 #42220074 未加载
评论 #42224179 未加载