> does the garbage collector reclaim cells that are accessible only > through a fulfilled promise? > > for instance, if > > val p:int list promise = promise() > > future p is satisfied, and the list referenced by p is not otherwise > accessible, will the list be garbage collected?
That entirely depends on whether p itself is garbage. If it is still reachable, then the list certainly cannot be collected, because somebody still might dereference p and obtain it (note that Promise.future really is just a fancy dereference operator). If OTOH p is garbage, then the list is garbage too. Promises are no different from any other data structure in this respect. > (corollary 1: if i have an "ever growing" list, only the last few cells > of which are ever accessible, but where the entire list is referenced by > a fulfilled promise, do i have a memory leak? If you keep the promise alive, yes. Do you have a specific example in mind? > corollary 2: should an illustration show p referencing its future after > p is fulfilled?) Yes, if by future you mean the value the future was replaced with (technically, the future itself is gone at that point). - Andreas _______________________________________________ alice-users mailing list [email protected] http://www.ps.uni-sb.de/mailman/listinfo/alice-users
