Avi: <br>I tried clearing the session cache amd forcing garbage collect. That helps only a part of the way. There's something else I'm missing.<br><br>Ramon:<br>I agree with your general point, that this is an issue of approach more than anything.
<br>Just like you said, I'm using a collection to keep track of the items. But after they're deleted from the collection, <br>they're still persisting, and accumulating. <br><br>Which leads me to suspect I'm missing something, some kind of references that I'm not releasing to them. 
<br>Is there any way to discover which objects are pointing to a particular instance?<br><br>And in general, is there no other way to &quot;release&quot; an object for garbage collecting, other than making sure there are no references to it?
<br><br><div><span class="gmail_quote">On 8/31/06, <b class="gmail_sendername">Ramon Leon</b> &lt;<a href="mailto:ramon.leon@allresnet.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ramon.leon@allresnet.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt; I suspect this might be a general Squeak question, but I want<br>&gt; to ask it here in case Seaside adds some complications or<br>&gt; things to consider:<br>&gt;<br>&gt; How do I delete object instances (is forcing garbage collection
<br>&gt; involved) from the image?<br>&gt;<br>&gt; So, for instance, say I have a simple Shopping Cart and Items<br>&gt; sort of setup.<br>&gt; I add several Items to the cart, which creates instances of<br>&gt; those objects.
<br>&gt;<br>&gt; And then I want to remove them from the cart, delete them.<br>&gt; But they're still around in the image, inspecting Item<br>&gt; allInstances still reveals those items which are no longer in<br>&gt; the cart.
<br>&gt;<br>&gt; This sort of thing happens all the time in my web apps (I'm<br>&gt; using the simplest form of persistence - in image, no<br>&gt; database or anything, while prototyping), and I'm wondering<br>&gt; how you guys get around that.
<br>&gt;<br>&gt; ~Dmitri<br><br>You shouldn't really force gc or flush the session caches, you really just<br>need to change your mindset.&nbsp;&nbsp;Once you remove them from the cart, forget<br>about them, they're gone, they'll be gc'd eventually.&nbsp;&nbsp;Don't use SomeClass
<br>allInstances as if it were a database, it's not.&nbsp;&nbsp;If you want to keep track<br>of all of your carts, or items, or whatever, put them in your own collection<br>or dictionary somewhere, so that when you remove them, they are effectively
<br>deleted.&nbsp;&nbsp;If you want in image persistence, try something like adding an<br>accessor on the class side like..<br><br>Order class&gt;&gt;allOrders<br>&nbsp;&nbsp;&nbsp;&nbsp;^allOrders ifNil: [allOrders := Dictionary new]<br><br>Then you can do stuff like
<br><br>Transcript show: (Order allOrders at: someId)<br><br>Order allOrders do:[:each |<br>&nbsp;&nbsp;html text: each asString; break].<br><br>Try to forget about the concept of delete, that's a relational concept, it<br>doesn't really exist in OO.&nbsp;&nbsp;With transparent persistence, an object is
<br>either referenced, or it isn't, that's all you have to think about.&nbsp;&nbsp;If you<br>want to save an object, just put it somewhere like<br><br>Order allOrders at: someId put: Order new.<br><br>Now it's saved.&nbsp;&nbsp;If you want to get rid of it, then remove it
<br><br>Order allOrders removeKey: someId<br><br>Or<br><br>Order allOrders remove: anOrder<br><br>That's it, it's gone.&nbsp;&nbsp;Don't worry that a transient reference might hang<br>around for a while, you shouldn't care, it's been removed from your model.
<br><br>Or maybe you want to consider you SeasideSession as a database, put stuff on<br>the class side<br><br>MySession&gt;&gt;allOrders<br>&nbsp;&nbsp;&nbsp;&nbsp;^self class allOrders<br><br>MySession class&gt;&gt;allOrders<br>&nbsp;&nbsp;&nbsp;&nbsp;^allOrders ifNil: [allOrders := Dictionary new]
<br><br>MySession&gt;&gt;allCustomers<br>&nbsp;&nbsp;&nbsp;&nbsp;^self class allCustomers<br><br>MySession class&gt;&gt;allCustomers<br>&nbsp;&nbsp;&nbsp;&nbsp;^allCustomers ifNil: [allCustomers := Dictionary new]<br><br>Then from you code it's<br><br>self session allOrders, or self session allCustomers.&nbsp;&nbsp;Just a couple simple
<br>ideas.<br><br>_______________________________________________<br>Seaside mailing list<br><a href="mailto:Seaside@lists.squeakfoundation.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Seaside@lists.squeakfoundation.org
</a><br><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br></blockquote></div><br>