Carl Shapiro wrote:
On Mon, Nov 30, 2009 at 10:08 AM, Lynn Quam <quam@ai.sri.com> wrote:
Sounds good to me. I have been using foreign code to accomplish this for many years. The only problem with this implementation is that the static arrays must be explicitly reclaimed.
A finalizer is attached to the array header but not to the data array. Come to think of it, it is not clear that it should not just be the other way around. This may require some work around the weak pointer code.
It's done this way because the data array is never really seen by GC since it's not in the from space (or even to space). Without the array header, I don't know how to tell that the array is garbage. I think Lynn and I did some experiments long ago with weak pointers and static arrays (lisp heap) but couldn't figure out how to break the weak pointer so that the object could be reclaimed. And this reminds of one more limitation: Don't grab a hold of the data vector of the array and drop all references to the array itself. The data vector will be GCed out from underneath you. But the only way to grab the data vector is to use CMUCL-specific functions, so if you do this, you're on your own. This limitation would go away if we could figure out how to make Carl's suggestion work. (I think his idea is a better implementation.) Ray