On Tue, Mar 31, 2020 at 9:25 AM Russ Whaley <whaley.r...@gmail.com> wrote:

> Sven,
> Thanks for the reply :)
>
> I will try to move my code over to another image (I'm not very good with
> GitHub - we'll see how this goes).
>
> But it just seems like there ought to be a way to at least delete all of
> these instances - as they are pretty easy to get ahold of (Class
> allInstancesDo:).  But I can't find a way to delete them.  I can count
> them, I can display content - attached is a screenshot showing for each
> Album instance, I can display it and data from it's embedded Artist and
> collection of Tracks.
>

Russ, this kind of thing is a common occurrence in Smalltalk GUI
applications. In my experience, it is often dangling dependencies resulting
in things being held. The reference in question might be to the model
itself or to some particular subset which also happens to include a back
reference to the whole model. These dependencies typically are installed as
event handlers in the GUI. It's common to establish a dependency but fail
to release it.

In your first message, you listed the major classes of your model. Get the
object counts for each. Close the application UI (not Pharo) and re-open
it. Run the counts again. You will probably see the root model instance
count increase by one.

I don't work with Pharo, so I cannot give you specific guidance for
tracking these down. I'm certain others can explain GUI dependencies and
dangling references in the Pharo environment, to give you more focussed
guidance.



> Attached are a couple of screen shots of the 'query' I mentioned in my
> previous note... as you can see - Tracks, Albums, (FileReference is my
> fault, also - I use those to hand music files to my objects for processing.
> Those are hanging around as well).
>
> On Tue, Mar 31, 2020 at 11:13 AM Sven Van Caekenberghe <s...@stfx.eu>
> wrote:
>
>> Hi Russ,
>>
>> It is quite hard to debug somebody else's application, especially without
>> access to the code, but here are some suggestions of what I would do.
>>
>> Can you move your code to a new/fresh image and see what happens there
>> (especially after just one iteration of loading your data) ?
>>
>> Is there a difference between loading your data and opening your app with
>> respect to the retention of garbage ? This would help to determine if this
>> is a UI problem or a domain model problem.
>>
>> There are tools that help you to figure out who holds a specific object
>> ('Reverse pointers to' in the Inspector) but these are not so easy to use
>> (you get lots of data).
>>
>> Sven
>>
>> > On 31 Mar 2020, at 16:55, Russ Whaley <whaley.r...@gmail.com> wrote:
>> >
>> > My image size keeps growing and growing.  I've been scouring Google and
>> mailing lists, trying to find a solution.
>> >
>> > Observables:
>> >       • Running this 'query' shows I have a whole lot instances of
>> Objects I've created that are not "releasing". There are 65000 instances of
>> one Object/Class, and 350,000 of another.  (there are more, these are just
>> the big hitters).
>> > (Object allSubclasses collect: [ :aClass |
>> >         aClass -> aClass allInstances size])
>> >         sort: [ :a :b | a value > b value ].
>> >       • Each time I load my app/UI - which creates/loads another 5000
>> of one object and 25,000 of the 2nd object - my Class>>instanceCount(s)
>> keep growing and so does my image size.
>> >       • I've done:
>> >               • Smalltalk garbageCollect.
>> >               • Smalltalk garbageCollectMost.
>> >               • 10 timesRepeat: [ Smalltalk garbageCollect]. (many,
>> many times)
>> > Somehow, these instances I create are not 'releasing'.  All of my
>> Classes are direct subclasses of Object.  Interestingly enough, all these
>> objects sit in a single collection for the high-level model - and there are
>> only 67 instances of that Object... here's the hierarchy:
>> >
>> > MyTunes - instance holds a Dictionary of Libraries, rootFolder and tags
>> collection
>> > Library - instance(s) hold Dictionary of Artists & Playlists, tags
>> collection, and MyTunes reference
>> > Artist - instances hold Dictionary of Albums, and Library reference
>> > Album - instances hold Dictionary of Tracks, and Artist reference
>> > Track - instances hold TagInfo, Album reference
>> > TagInfo - instances hold fileReference and ByteString of ID3 tag info.
>> > PlayList - instances hold Dictionary of Tracks, Library reference.
>> >
>> > Here's my start code in my app... (I don't know how to use
>> SpApplication, SpPresenter and my model(s) together - this may be part of
>> the problem)..
>> >
>> > start
>> > "Override this to start your app"
>> > "*** I don't know how to use SpApplicatoin, SpPresenter and my model
>> MyTunes ***"
>> >
>> > | myTunes tmpLibrary myPres |
>> >
>> > "where do I store the model -> MyTunes?"
>> > myTunes := MyTunes new.
>> >
>> > "this is just for testing, but the actual re-load of the library takes
>> 15-20 minutes (60,000 files!)"
>> > tmpLibrary := myTunes readLibraryFromSTONfile.
>> > myTunes addLibrary: tmpLibrary.
>> >
>> > "where do I store the presenter -> MyTunesPresenter? "
>> > myPres := MyTunesPresenter on: tmpLibrary.
>> > myPres openWithSpec.
>> >
>> > While I'd love help with my App/Pres/Model - my first goal is to stop
>> the rapid growth of my object.
>> >
>> > Questions?
>> >
>> > Thanks!
>> > Russ Whaley (USA, Ohio)
>> >
>> > --
>> > Russ Whaley
>> > whaley.r...@gmail.com
>>
>>
>>
>
> --
> Russ Whaley
> whaley.r...@gmail.com
>

Reply via email to