Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

FORCED COLLECTION OF GARBAGE

Name: THREAD BEGIN 2011-09-27 8:39

I was thinking, we have let and let*, which can be considered like an idea of use-once. Are there commands or values you can tag onto a new thing so the garbage collector knows to keep or forget it?

Even better, it can be optimized by having a sort of graveyard collector, where after something is forgotten, the graveyard collector keeps the name and type of the data, so if the data is called for after it was forgotten, the graveyard collector can just recreate the value with keep set to on.

This way, you could still simplify programs by using garbage collection, but could optimize for when you don't want something around, or do.

Name: Anonymous 2011-09-27 9:06

There are a few ways to do what you want, but they are implementation dependent.
http://www.sbcl.org/manual/Garbage-Collection.html for an example
What you want is usually implemented as a few macros that use weak pointers or gc-hooks, and sometimes also stuff involving the MOP (if your design uses CLOS). There are a few projects using such tricks, especially database-related ones, but I can't recall their names, so you should ask #lisp instead as they likely remember them better.
Also, I think Ken Tilton's Cells had a similar idea as yours (recalculating values on need), but I have no idea if he uses weak pointers for his code (although it'd be easy to change it to use them if he doesn't).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List