Overview
| Artifact ID: | 2dfaab0320ab398cccefc6377330ddb1855c644e |
|---|---|
| Ticket: | 2960042fffffffffffffffffffffffffffffffff
high water mark memory not shared for file I/O needs |
| User & Date: | dkf on 2010-03-04 17:16:50 |
Changes
- icomment:
Doing GC is... well, not a small project. Best make it out of scope for our own sanity. :-) My original code (now rather bitrotted, even if I can find a copy which may be impossible) for doing this had a scheme for getting memory pages directly from the OS (every modern OS can do that) which I'd then put a header structure at the start of the page and fill the rest of the page with (initially unused) Tcl_Obj structures. I'd then do some evil bit bashing to go from the address of a Tcl_Obj to the address of the page containing it (using the obvious fact that the page is aligned on a page boundary) so that I could cheaply get the accounting structure. Overall, I'd throw away pages back to the OS (possible since I'd got them allocated directly instead of via malloc) when a page had no in-use objects on it; I'd keep around one spare page on deallocation so that there wouldn't be disastrous performance effects if there were allocations back and forth across a page boundary. The reason why this strategy usually works? It depends on the fact that most apps have a group of objects that have long lifetimes and many others that have short lifetimes; even though there will be some pages locked down because of the long lifetimes, there will be many others that are able to be freed. Generational garbage collectors use the same set of basic underlying assumptions about the population of object lifetimes, and they seem to work really well in practice. The main problem is just one of engineering. Getting it all to work really stably across many platforms is quite challenging (at the time I was working on this, I had the advantage of only needing it to work on 32-bit SPARC running Solaris).
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"