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

Pages: 1-

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 8:47

>>1
Well, it'd create the default value for that datatype, possibly with function commands so like it could remember "table grid 4 4" so if table was used again, the default values for a grid of 4 4 would be entered and loaded. It wouldn't remember the old value of the construct, that just wouldn't make sense.

Name: Anonymous 2011-09-27 8:52

Name: Anonymous 2011-09-27 8:59

>>3
I believe you misinterpreted what I said.

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).

Name: Anonymous 2011-09-27 9:20

>>5
Ah, that's better, but it seems like my idea should be relatively simple to describe by someone professional. One of the problems in making it work well is everything would kind of need a pointer for normal use, then a name so that way the collectors can do both tasks reasonably.

Even without the graveyard tool, it seems there should be SOME garbage collector you can give commands to free up memory when you don't need it, but I guess I'm just thinking of manual memory management.

Name: Anonymous 2011-09-27 9:23

>>6
You could just use weak pointers and force gc. If that's not enough, you'll have to hack on some implementation by yourself to get more precise control (or just use undocumented functions and hope nothing breaks too badly).

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