On Wed, Aug 3, 2011 at 1:01 PM, Nicolas Cellier < [email protected]> wrote:
> You replace Array with self arrayType, that's all. > Here my images freezes and CPU goes 100%. I guess because compiling/saving a method uses OrderedCollection grow at the same time. > But there is better, Pharo already has growAtFirst and growAtLast > which are correct. > Use them instead of grow. > See SLICE in inbox. > I cannot load it since it freezes in "Cleaning Up". It can be the same reason as why I cannot save the modification. I am in Pharo1.3 Latest update: #13277 Thanks a lot for the help! > > Nicolas > > 2011/8/3 Mariano Martinez Peck <[email protected]>: > > btw...how can I change OrderedCollection>>grow > > without shooting my foots? > > > > On Wed, Aug 3, 2011 at 12:51 PM, Mariano Martinez Peck > > <[email protected]> wrote: > >> > >> > >> On Wed, Aug 3, 2011 at 12:42 PM, Nicolas Cellier > >> <[email protected]> wrote: > >>> > >>> I'm pretty sure the array inst var of your WeakOrderedColleciton is no > >>> more a WeakArray but a simple Array. > >> > >> Yes, indeed, it is a normal Array and that cought my attention. But > since > >> I have no idea about Weak stuff...I also noticed that > WeakOrderedCollection > >> is declared as: > >> > >> OrderedCollection subclass: #WeakOrderedCollection > >> instanceVariableNames: '' > >> classVariableNames: '' > >> poolDictionaries: '' > >> category: 'Collections-Weak' > >> > >> instead of using the #weakSubclass: ... message: > >> > >> OrderedCollection weakSubclass: #WeakOrderedCollection > >> instanceVariableNames: '' > >> classVariableNames: '' > >> poolDictionaries: '' > >> category: 'Collections-Weak' > >> > >> > >>> > >>> This is because Pharo's WeakOrderedCollection is broken... > >>> > >> > >> Do you know a weak collection that is not broken in Pharo and let me do > a > >> addLast: ? > >> > >>> > >>> Every reference to Array from within OrderedCollection should be > >>> replaced with message send (self arrayType). > >>> See for example, OrderedCollection>>#grow > >>> > >> > >> Thanks. I will check how many there are and try to fix them. > >> > >>> > >>> Nicolas > >>> > >>> 2011/8/3 Mariano Martinez Peck <[email protected]>: > >>> > Hi guys. I am since yesterday trying to find something and I cannot. > So > >>> > at > >>> > this point I need external eyes :) > >>> > I have this little code: > >>> > > >>> > anObject := ClassWith2Var new. > >>> > sharedObject := ClassWith1Var new. > >>> > sharedObject var1: 'nose'. > >>> > anObject var1: Date today. > >>> > anObject var2: sharedObject. > >>> > > >>> > serializedObjects := FuelMareaSerializer new > >>> > serializeAndWriteObject: > >>> > anObject to: 'aFileName'. > >>> > anObject := nil. > >>> > sharedObject := nil. > >>> > > >>> > 3 timesRepeat: [Smalltalk garbageCollect]. > >>> > serializedObjects inspect. > >>> > > >>> > > >>> > > >>> > What is important here is that FuelMareaSerializer new > >>> > serializeAndWriteObject: anObject to: 'aFileName' answers a > >>> > WeakOrderedCollection with each object of the serialized graph > (taking > >>> > anObject as the root) > >>> > Now, if I print the tempVar serializedObjects I see: > >>> > > >>> > a WeakOrderedCollection(ClassWith1Var ClassWith2Var Date DateAndTime > >>> > Duration a ClassWith1Var a ClassWith2Var 3 August 2011 > >>> > 2011-08-03T00:00:00+02:00 0:02:00:00 1:00:00:00 86400 2455777 'nose' > 0 > >>> > 7200) > >>> > > >>> > WHYYYY?? why are all there if I put a nil to both, anObject and > >>> > sharedObejct. This WeakOrderedCollection should be with all nils > >>> > (except > >>> > classes). Why are not being garbage collected? > >>> > > >>> > If I explore, for example the tempVar sharedObejct, which is at > >>> > serializedObjects at: 6 and then I put explore pointers I ONLY see > >>> > the > >>> > array of the WeakOrderedCollection pointing to it. I don't > understand. > >>> > > >>> > Any help is really appreaciated. > >>> > > >>> > -- > >>> > Mariano > >>> > http://marianopeck.wordpress.com > >>> > > >>> > > >>> > >> > >> > >> > >> -- > >> Mariano > >> http://marianopeck.wordpress.com > >> > > > > > > > > -- > > Mariano > > http://marianopeck.wordpress.com > > > > > > -- Mariano http://marianopeck.wordpress.com
