Image Size (Was Cleaning up old domain objects)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Image Size (Was Cleaning up old domain objects)

Rob Rothwell
On Sun, May 25, 2008 at 4:49 PM, Janko Mivšek <[hidden email]> wrote:
Rob Rothwell wrote:
I seem to have old versions of my domain object (PatientData) that Aida seems to be holding on to so I can't garbageCollect them.  I have done SwazooAida stop and garbageCollected, but the PointerFinder tool still finds that they exist as illustrated below:

Domain object are registered in three places:

1. WebSession instvar #appsForObjects, which maintains a dictionary of app for every domain object. Not that there is usually many sessions having this mapping for the same domain object.
2. App instvar #observee, pointing directly to domain object
3. UrlResolver

So, if you want to get rid of domain object, you need to remove it from  sessions and Url resolver. I'm usually clearing all apps in sessions every night by:

 WebSessionManager allInstances do: [:each | each removeGuestSessions].
 WebSession allInstances do: [:each | each initAppsForObjects].

First one is in our case not necessary but recommended while second is specially recommended. Note that with this you kind of "timeout" user's presentation states too. Also you release quite some memory.

But your domain object will still stay registered on UrlResolver. You need to manually remove it:

       (AIDASite named: 'yoursite') urlResolver removeObject: myObject

Is there an order to the above instructions?  When I do

WebSessionManager allInstances do: [:each | each removeGuestSessions].
WebSession allInstances do: [:each | each initAppsForObjects].

followed by

Smalltalk garbageCollectMost, it seems to have no effect on my ever growing image size, which start off at about 35Mb, and is now up to about 76Mb working on just one Aida project with on site and lots of testing in the web browser.

Is this normal?  Do I need to ask the Beginners list about simple image maintenance?  Is this a normal Aida phenomenon, or could I be not maintaining my objects properly? 

If I was programming for Windows, I'd say I have a memory leak somewhere! 

Thanks,

Rob





_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Image Size (Was Cleaning up old domain objects)

Rob Rothwell
On Sun, May 25, 2008 at 4:49 PM, Janko Mivšek <[hidden email]> wrote:
Rob Rothwell wrote:
I seem to have old versions of my domain object (PatientData) that Aida seems to be holding on to so I can't garbageCollect them.  I have done SwazooAida stop and garbageCollected, but the PointerFinder tool still finds that they exist as illustrated below:

Domain object are registered in three places:

1. WebSession instvar #appsForObjects, which maintains a dictionary of app for every domain object. Not that there is usually many sessions having this mapping for the same domain object.
2. App instvar #observee, pointing directly to domain object
3. UrlResolver

So, if you want to get rid of domain object, you need to remove it from  sessions and Url resolver. I'm usually clearing all apps in sessions every night by:

 WebSessionManager allInstances do: [:each | each removeGuestSessions].
 WebSession allInstances do: [:each | each initAppsForObjects].

First one is in our case not necessary but recommended while second is specially recommended. Note that with this you kind of "timeout" user's presentation states too. Also you release quite some memory.

But your domain object will still stay registered on UrlResolver. You need to manually remove it:

       (AIDASite named: 'yoursite') urlResolver removeObject: myObject

Is there an order to the above instructions?  When I do

WebSessionManager allInstances do: [:each | each removeGuestSessions].
WebSession allInstances do: [:each | each initAppsForObjects].

followed by

Smalltalk garbageCollectMost, it seems to have no effect on my ever growing image size, which start off at about 35Mb, and is now up to about 76Mb working on just one Aida project with on site and lots of testing in the web browser.

Is this normal?  Do I need to ask the Beginners list about simple image maintenance?  Is this a normal Aida phenomenon, or could I be not maintaining my objects properly? 

If I was programming for Windows, I'd say I have a memory leak somewhere! 

Thanks,

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Image Size (Was Cleaning up old domain objects)

Janko Mivšek
Hi Rob,

Rob Rothwell wrote:

> Is there an order to the above instructions?  When I do
>
> WebSessionManager allInstances do: [:each | each removeGuestSessions].
> WebSession allInstances do: [:each | each initAppsForObjects].
>
> followed by
>
> Smalltalk garbageCollectMost, it seems to have no effect on my ever
> growing image size, which start off at about 35Mb, and is now up to
> about 76Mb working on just one Aida project with on site and lots of
> testing in the web browser.
>
> Is this normal?  Do I need to ask the Beginners list about simple image
> maintenance?  Is this a normal Aida phenomenon, or could I be not
> maintaining my objects properly?
>
> If I was programming for Windows, I'd say I have a memory leak somewhere!

You probably have not memory but "object leak" somewhere. First, to
measure real Squeak memory consumption, use MemoryUsage (load it from
SqueakMap) and not what is reported by Linux. For instance, by
MemoryUsage my squeaksite demo uses 88.4M right now bit Linux reports
95M RES and even 1029M VIRT!

I just checked how much memory consumes Damien's squeak-web with Aida
preloaded: 38M

Ok, who is consuming the rest of memory is harder to find. Usually you
start with counting allInstances of your classes to see if there is
unusually high number of some of them.

Janko



--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Image Size (Was Cleaning up old domain objects)

Rob Rothwell
On Tue, Jun 3, 2008 at 2:50 PM, Janko Mivšek <[hidden email]> wrote:
You probably have not memory but "object leak" somewhere. First, to measure real Squeak memory consumption, use MemoryUsage (load it from SqueakMap) and not what is reported by Linux. For instance, by MemoryUsage my squeaksite demo uses 88.4M right now bit Linux reports 95M RES and even 1029M VIRT!

I  loaded my package into a clean image and will keep an eye on MemoryUsage while I ask for some general advice on being a good caretaker of my objects...I feel like I must be doing something not quite right...

I just checked how much memory consumes Damien's squeak-web with Aida preloaded: 38M

I started with squeak-dev, added a few packages + Aida, and am at 49M.  I figure the FreeType fonts chew up a good part of that...
 
Ok, who is consuming the rest of memory is harder to find. Usually you start with counting allInstances of your classes to see if there is unusually high number of some of them.

I'll wander on over to the Beginners List and start asking for some advice!  I can do MyClass allInstances; now I just need to find MyPackage allClasses!


Thank you again,

Rob

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Image Size (Was Cleaning up old domain objects)

Nicolas Petton

Le mardi 03 juin 2008 à 19:09 -0400, Rob Rothwell a écrit :

> On Tue, Jun 3, 2008 at 2:50 PM, Janko Mivšek <[hidden email]>
> wrote:
>         You probably have not memory but "object leak" somewhere.
>         First, to measure real Squeak memory consumption, use
>         MemoryUsage (load it from SqueakMap) and not what is reported
>         by Linux. For instance, by MemoryUsage my squeaksite demo uses
>         88.4M right now bit Linux reports 95M RES and even 1029M VIRT!
>
> I  loaded my package into a clean image and will keep an eye on
> MemoryUsage while I ask for some general advice on being a good
> caretaker of my objects...I feel like I must be doing something not
> quite right...
>
>
>         I just checked how much memory consumes Damien's squeak-web
>         with Aida preloaded: 38M
>
> I started with squeak-dev, added a few packages + Aida, and am at 49M.
> I figure the FreeType fonts chew up a good part of that...
>  
>
>         Ok, who is consuming the rest of memory is harder to find.
>         Usually you start with counting allInstances of your classes
>         to see if there is unusually high number of some of them.
>
>
> I'll wander on over to the Beginners List and start asking for some
> advice!  I can do MyClass allInstances; now I just need to find
> MyPackage allClasses!
>
Did you try something like:

| instances |

instances := 0.
(Smalltalk allClasses select: [:each | each category beginsWith: 'xxx'])
    do: [:each | instances := instances + each allInstances size].

Cheers!

Nico
--
Nicolas Petton
http://nico.bioskop.fr
            ___
          ooooooo
         OOOOOOOOO
        |Smalltalk|
         OOOOOOOOO
          ooooooo
           \   /
            [|]
--------------------------------
Ma clé PGP est disponible ici :
http://nico.bioskop.fr/pgp-key.html

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Image Size (Was Cleaning up old domain objects)

Nicolas Petton
In reply to this post by Rob Rothwell
Usually, when my image size grows up, I clean up with some simple code
like:

WebSessionManager allInstancesDo: [:each | each removeAllSessions].
MCFileBasedRepository flushAllCaches.
SMSqueakMap default clearCaches.
Smalltalk removeEmptyMessageCategories.
Undeclared removeUnreferencedKeys.
Symbol compactSymbolTable.
Smalltalk garbageCollect.

Nico



Le mardi 03 juin 2008 à 19:09 -0400, Rob Rothwell a écrit :

> On Tue, Jun 3, 2008 at 2:50 PM, Janko Mivšek <[hidden email]>
> wrote:
>         You probably have not memory but "object leak" somewhere.
>         First, to measure real Squeak memory consumption, use
>         MemoryUsage (load it from SqueakMap) and not what is reported
>         by Linux. For instance, by MemoryUsage my squeaksite demo uses
>         88.4M right now bit Linux reports 95M RES and even 1029M VIRT!
>
> I  loaded my package into a clean image and will keep an eye on
> MemoryUsage while I ask for some general advice on being a good
> caretaker of my objects...I feel like I must be doing something not
> quite right...
>
>
>         I just checked how much memory consumes Damien's squeak-web
>         with Aida preloaded: 38M
>
> I started with squeak-dev, added a few packages + Aida, and am at 49M.
> I figure the FreeType fonts chew up a good part of that...
>  
>
>         Ok, who is consuming the rest of memory is harder to find.
>         Usually you start with counting allInstances of your classes
>         to see if there is unusually high number of some of them.
>
>
> I'll wander on over to the Beginners List and start asking for some
> advice!  I can do MyClass allInstances; now I just need to find
> MyPackage allClasses!
>
>
> Thank you again,
>
> Rob
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Image Size (Was Cleaning up old domain objects)

Rob Rothwell
In reply to this post by Nicolas Petton
On Tue, Jun 3, 2008 at 9:27 PM, Nicolas Petton <[hidden email]> wrote:
| instances |

instances := 0.
(Smalltalk allClasses select: [:each | each category beginsWith: 'xxx'])
   do: [:each | instances := instances + each allInstances size].

No...(hangs head in shame!)...the "each category beginsWith:" eluded me...

(I was admittedly, doing it "by hand")

So...183 instances of my various objects in my  Package...I will have to find a way to get their memory usage...

So, for grins, I removed my package, ran your "simple" code:

WebSessionManager allInstancesDo: [:each | each removeAllSessions].
MCFileBasedRepository flushAllCaches.
SMSqueakMap default clearCaches.
Smalltalk removeEmptyMessageCategories.
Undeclared removeUnreferencedKeys.
Symbol compactSymbolTable.
Smalltalk garbageCollect.

and STILL have an image about twice as large as when I started?!

This may take a while to figure out.  I think I need training in object maintenance.

Thank you!

Rob


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida