Hi,

> Hi Michaël,
>    You are one step ahead of me.  I had just reached the same 
> conclusion and did the mods to remove the references and it worked.

You are a step ahead of me because I still have to do the mods ;-)
Thanks for giving classes to modify

Do you know that I started to compile the mods you did in skyjump on 
http://openjump.org/wiki/show/SkyJUMP+-+OpenJUMP+Synchronization ?
and I did my first synchro yesterday with the union plugin...
Maybe I'll have question if I go on with more complex improvements...

Sunburned, here is a 5 minutes tutorial for heap analysis : 
http://blog.emptyway.com/2007/04/02/finding-memory-leaks-in-java-apps/

Michaël

> The mods are:
>
> In RemoveSelectedLayersPlugin:
>   public boolean execute(PlugInContext context) throws Exception {
>         remove(context, (Layerable[]) 
> (context.getLayerNamePanel()).selectedNodes(
>
> In LayerManager:
>    public void dispose(PlugInContext context, Layerable layerable) {
>      // removing the reference to layer       
> context.getLayerViewPanel().getRenderingManager().removeLayerRenderer(layer);
>
> In RenderManager:
>     public void removeLayerRenderer(Layer layer){
>         contentIDToRendererMap.remove(layer);
>     }
>
> I'm struck by the coincidence of SS's post on rendering juxtaposed 
> with David's post.
>
> regards,
> Larry Becker
> On 5/21/07, *Michaël Michaud* <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hi,
>
>     I think I get it ;
>
>     Here is what I obtained after a dump of jump's memory
>     I loaded a shapefile, I deleted it from the menu, then I made a
>     dump of
>     the the heap
>     in order to get the objects dependency graph with the jhat analyser :
>
>     My 10 BasicFeatures are held in a list
>     which in turn is referenced by a Collections$SingletonMap
>     referenced by a SimpleFeatureCollectionRenderer
>     referenced by a LayerRenderer
>     referenced by a HashMap
>     referenced by the RenderingManager
>
>     What happens is that the rendering system has a kind of cache
>     (layerToFeaturesMap in SimpleFeatureRenderer)
>     which behaviour may be revealed by the following experience :
>
>     load a shapefile --> 50 Mo commited (data + rendering)
>     remove it          --> 50 Mo commited (data + rendering)
>
>     now
>
>     load the shapefile --> 50 Mo commited (data + rendering)
>     pan until shapefile
>     is no more visible --> 45 Mo or so (just the data)
>     remove layer       --> 10 Mo (no more data in the cache, memory is
>     free)
>
>     but
>
>     load the shapefile --> 50 Mo commited (data + rendering)
>     remove the layer --> 50 Mo
>     pan                    --> 50 Mo or so (cached data is prisonner !!)
>
>     Hope that's help
>
>     Michaël
>
>
>
>     Sunburned Surveyor a écrit :
>
>     > This may be a really stupid thing to suggest, but I'll throw it out
>     > there anyways.
>     >
>     > In JUMP there is a LayerListener interface defined. Is it possible
>     > that a plug-in would implement this interface in a way that
>     would hold
>     > onto a reference to a Layer object?
>     >
>     > For instance, I see that both the LayerEvent and FeatureEvent
>     classes
>     > allow you to obtain a reference to a Layer and/orLayerable. I
>     think a
>     > plug-in could [1] register itself as a LayerListener, [2] obtain a
>     > reference to a Layer object when it receives either a LayerEvent or
>     > FeatureEvent, and [3] keep a reference to the Layer object until the
>     > plug-in is destroyed.
>     >
>     > If the problem behavior described is inconsistent it could be a
>     > plug-in that is not alwaysor commonly used.
>     >
>     > This is just a suggestion. My work on the pluggable rendering system
>     > has demonstrated how little I know about Java programming in general
>     > and JUMP in particular. :]
>     >
>     > The Sunburned Surveyor
>     >
>     > On 5/21/07, *A. Craig West* <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
>     >
>     >     It seems likely that there are stale references somewhere,
>     then. I
>     >     remember an older version of the GridBagLayout used to have
>     a bug
>     >     where all obljects added to it were hung onto for the life
>     of the
>     >     GBL, because the remove code didn't take refernces out of an
>     >     internal Hashtable. Has anybody tried something like JProbe
>     on the
>     >     problem? I've had a fair amount of success with that in the
>     past.
>     >     Conveniently, I now work for the company that wrote JProbe,
>     so I'm
>     >     sure I can give it a go, if nobody else has...
>     >     -Craig
>     >
>     >     On 5/21/07, *david alejandro garcia ortega* <
>     [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>     >     <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>>
>     wrote:
>     >
>     >         I think is a problem with the code, like Larry says , i
>     think
>     >         is possible to free memory but the gc() doesn´t work because
>     >         there are references to the Layer.
>     >
>     >
>     >
>     >
>     >          DAVID GARCIA
>     >
>     >            
>     ------------------------------------------------------------------------
>
>     >             From: /"Larry Becker" <[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     >             <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]> >>/
>     >             Reply-To: /"List for discussion of JPP development and
>     >             use." < jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>
>     >             <mailto:jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>>>/
>     >             To: /"List for discussion of JPP development and
>     use." <
>     >             jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>
>     >             <mailto:jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>>>/
>     >             Subject: /Re: [JPP-Devel] Question?/
>     >             Date: /Mon, 21 May 2007 11:55:47 -0500/
>     >
>     >
>     >             Hi Craig,
>     >
>     >               Good point, however if you close the task
>     (project) all
>     >             memory is reclaimed, so it would seem to be possible to
>     >             reclaim it by removing a layer.
>     >
>     >             Larry
>     >
>     >             On 5/21/07, *A. Craig West* < [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     >             <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>> wrote:
>     >
>     >                 Do we know if this is a problem with references
>     being
>     >                 hung onto
>     >                 internally, or just the standard Java VM behavior
>     >                 where the Java VM
>     >                 normally doesn't return memory to the OS?
>     >                 -Craig
>     >
>     >                 On 5/21/07, Stefan Steiniger <
>     [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>     >                 <mailto: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>> wrote:
>     >> hei David,
>     >>
>     >> in case you don't know
>     >> what sometimes can help a bit is to press the
>     >                 "garbage collect" button
>     >> of the help/about/info tab
>     >>
>     >> but only sometimes :I
>     >>
>     >> stefan
>     >>
>     >> david alejandro garcia ortega schrieb:
>     >> > Thanks Larry i will try to find a solution to the
>     >                 problem.
>     >> >
>     >> >  DAVID GARCIA
>     >> >
>     >> >
>     >                
>     ------------------------------------------------------------------------
>     >
>     >> >     From: /"Larry Becker" < [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     >                 <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]> >>/
>     >> >     Reply-To: /"List for discussion of JPP
>     >                 development and use."
>     >> >     < jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto:jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>>>/
>     >> >     To: /"List for discussion of JPP development
>     >                 and use."
>     >> >     < jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto: jump-pilot-devel@lists.sourceforge.net
>     <mailto:jump-pilot-devel@lists.sourceforge.net>>>/
>     >> >     Subject: /Re: [JPP-Devel] Question?/
>     >> >     Date: /Mon, 21 May 2007 11:03:03 -0500/
>     >> >
>     >> >     Hi David,
>     >> >
>     >> >       Welcome to the list.  That is an excellent
>     >                 question. I wish I had
>     >> >     an answer for you, but it is one of the
>     >                 unsolved problems with JUMP
>     >> >     (all flavors I believe).  In my tests, it is
>     >                 not even consistent.
>     >> >     Sometimes removing a layer will free most of
>     >                 the memory, but usually
>     >> >     it will not.
>     >> >
>     >> >       There have been attempts made to fix the
>     >                 problem in OpenJump.  See
>     >> >     :
>     >> >
>     >                
>     com.vividsolutions.jump.workbench.ui.plugin.RemoveSelectedLayersPlugIn
>     >> >     method remove(Layerable[]) which calls
>     >> >
>     >                
>     selectedLayers[i].getLayerManager().dispose(selectedLayers[i])
>     >                 and
>     >> >     does everything you could reasonably expect,
>     >                 however much of the
>     >> >     memory, usually all of it, is still committed
>     >                 after this code runs.
>     >> >
>     >> >     Apparently some plugin(s) still have references
>     >                 to the disposed
>     >> >     layers.  Probably via a listener of some kind,
>     >                 but no one has ever
>     >> >     tracked down the problem.
>     >> >
>     >> >       David, you would be doing a great service to
>     >                 the whole JUMP
>     >> >     community if you could find the solution to
>     >                 this problem.
>     >> >
>     >> >     regards,
>     >> >     Larry Becker
>     >> >
>     >> >     On 5/21/07, *david alejandro garcia ortega* <
>     >                 [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>
>     >> >     <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>     >                 <mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>>>> wrote:
>     >> >
>     >> >         Hi  I am working with the source code of
>     >                 OpenJump and i have the
>     >> >         following question:
>     >> >
>     >> >         When I load a dataset(shapefile)  commited
>     >                 memory is about
>     >> >         150Mb, then when I remove the dataset the
>     >                 commited memory is
>     >> >         about 140Mb. Why doesn´t memory free?
>     >> >
>     >> >         I want to free memory when the layer is
>     >                 turned invisible calling
>     >> >         dispose() of layer class, and when is
>     >                 turned visible I load the
>     >> >         featurecollection again. But this not work
>     >                 i can´t free memory.
>     >> >         What can i do?
>     >> >
>     >> >         Thanks, and sorry for my English i am from
>     >                 México.
>     >> >
>     >> >
>     >> >
>     >                
>     ------------------------------------------------------------------------
>
>     >
>     >> >         Windows Live Spaces en Prodigy/MSN Haz clic
>     >                 aquí
>     >> >         <http://g.msn.com/8HMBESMX/2743??PS=47575
>     <http://g.msn.com/8HMBESMX/2743??PS=47575>
>     >                 <http://g.msn.com/8HMBESMX/2743??PS=47575>>La
>     red más
>     >                 grande en
>     >> >         México y el mundo.
>     >> >
>     >                
>     -------------------------------------------------------------------------
>     >> >         This SF.net email is sponsored by DB2 Express
>     >> >         Download DB2 Express C - the FREE version
>     >                 of DB2 express and take
>     >> >         control of your XML. No limits. Just data.
>     >                 Click to get it now.
>     >> >         http://sourceforge.net/powerbar/db2/
>     >> >
>     >                 _______________________________________________
>     >> >         Jump-pilot-devel mailing list
>     >> >         Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto:Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >> >         <mailto:
>     >                 Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto:Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>>
>     >> >
>     >                
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >                 <
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel>
>     >> >
>     >> >
>     >> >
>     >> >
>     >> >     --
>     >> >     http://amusingprogrammer.blogspot.com/
>     >                 <http://amusingprogrammer.blogspot.com/>
>     >> >
>     >>
>     >      
> >-------------------------------------------------------------------------
>
>     >
>     >> >      >This SF.net email is sponsored by DB2 Express
>     >> >      >Download DB2 Express C - the FREE version of
>     >                 DB2 express and take
>     >> >      >control of your XML. No limits. Just data.
>     >                 Click to get it now.
>     >> >      > http://sourceforge.net/powerbar/db2/
>     >> >
>     >> >      >_______________________________________________
>     >> >      >Jump-pilot-devel mailing list
>     >> >      > Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto: Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >>
>     >      >https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >                 <
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel>
>     >> >
>     >> >
>     >> >
>     >                
>     ------------------------------------------------------------------------
>
>     >> > Comparte archivos de manera inmediata con Windows
>     >                 Live Messenger en
>     >> > Prodigy/MSN Haz clic aquí <
>     >                 http://g.msn.com/8HMAESMX/2731??PS=47575>
>     >> >
>     >> >
>     >> >
>     >                
>     ------------------------------------------------------------------------
>     >
>     >> >
>     >> >
>     >                
>     -------------------------------------------------------------------------
>     >> > This SF.net email is sponsored by DB2 Express
>     >> > Download DB2 Express C - the FREE version of DB2
>     >                 express and take
>     >> > control of your XML. No limits. Just data. Click to
>     >                 get it now.
>     >> > http://sourceforge.net/powerbar/db2/
>     <http://sourceforge.net/powerbar/db2/>
>     >                 <http://sourceforge.net/powerbar/db2/>
>     >> >
>     >> >
>     >> >
>     >                
>     ------------------------------------------------------------------------
>
>     >
>     >> >
>     >> > _______________________________________________
>     >> > Jump-pilot-devel mailing list
>     >> > Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto:Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >> >
>     >                
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >                
>     <https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     <https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel>>
>     >>
>     >>
>     -------------------------------------------------------------------------
>     >
>     >> This SF.net email is sponsored by DB2 Express
>     >> Download DB2 Express C - the FREE version of DB2
>     >                 express and take
>     >> control of your XML. No limits. Just data. Click to
>     >                 get it now.
>     >> http://sourceforge.net/powerbar/db2/
>     <http://sourceforge.net/powerbar/db2/>
>     >                 <http://sourceforge.net/powerbar/db2/>
>     >> _______________________________________________
>     >> Jump-pilot-devel mailing list
>     >> Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto:Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >                 <
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel>
>     >>
>     >
>     >                
>     -------------------------------------------------------------------------
>     >
>     >                 This SF.net email is sponsored by DB2 Express
>     >                 Download DB2 Express C - the FREE version of DB2
>     >                 express and take
>     >                 control of your XML. No limits. Just data. Click to
>     >                 get it now.
>     >                 http://sourceforge.net/powerbar/db2/
>     >                 _______________________________________________
>     >                 Jump-pilot-devel mailing list
>     >                 Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >                 <mailto: Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >                
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >                 <
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel>
>     >
>     >
>     >
>     >
>     >             --
>     >             http://amusingprogrammer.blogspot.com/
>     >
>     
> >>-------------------------------------------------------------------------
>     >>This SF.net email is sponsored by DB2 Express
>     >>Download DB2 Express C - the FREE version of DB2 express
>     >             and take
>     >>control of your XML. No limits. Just data. Click to get it
>     >             now.
>     >> http://sourceforge.net/powerbar/db2/
>     >             <http://sourceforge.net/powerbar/db2/>
>     >
>     >>_______________________________________________
>     >>Jump-pilot-devel mailing list
>     >> Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >             <mailto:Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >>https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >             <
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel>
>     >
>     >
>     >        
>     ------------------------------------------------------------------------
>     >         ¿ Ya conoces el mejor buscador? Haz clic aquí
>     >         <http://g.msn.com/8HMAESMX/2728??PS=47575>Corregido y
>     >         aumentado: Live Search en Prodigy/MSN
>     >        
>     -------------------------------------------------------------------------
>
>     >         This SF.net email is sponsored by DB2 Express
>     >         Download DB2 Express C - the FREE version of DB2 express
>     and take
>     >         control of your XML. No limits. Just data. Click to get
>     it now.
>     >         http://sourceforge.net/powerbar/db2/
>     >         <http://sourceforge.net/powerbar/db2/>
>     >         _______________________________________________
>     >         Jump-pilot-devel mailing list
>     >         Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >         <mailto: Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >        
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >
>     >
>     >
>     >    
>     -------------------------------------------------------------------------
>     >     This SF.net email is sponsored by DB2 Express
>     >     Download DB2 Express C - the FREE version of DB2 express and
>     take
>     >     control of your XML. No limits. Just data. Click to get it now.
>     >     http://sourceforge.net/powerbar/db2/
>     >     < http://sourceforge.net/powerbar/db2/>
>     >     _______________________________________________
>     >     Jump-pilot-devel mailing list
>     >     Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >     <mailto:Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>>
>     >    
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     <https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel>
>     >
>     >
>     >------------------------------------------------------------------------
>     >
>     >-------------------------------------------------------------------------
>     >This SF.net email is sponsored by DB2 Express
>     >Download DB2 Express C - the FREE version of DB2 express and take
>     >control of your XML. No limits. Just data. Click to get it now.
>     >http://sourceforge.net/powerbar/db2/
>     <http://sourceforge.net/powerbar/db2/>
>     >
>     >------------------------------------------------------------------------
>     >
>     >_______________________________________________
>     >Jump-pilot-devel mailing list
>     > Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     >https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>     >
>     >
>
>
>     -------------------------------------------------------------------------
>
>     This SF.net email is sponsored by DB2 Express
>     Download DB2 Express C - the FREE version of DB2 express and take
>     control of your XML. No limits. Just data. Click to get it now.
>     http://sourceforge.net/powerbar/db2/
>     _______________________________________________
>     Jump-pilot-devel mailing list
>     Jump-pilot-devel@lists.sourceforge.net
>     <mailto:Jump-pilot-devel@lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>
>
>
>
> -- 
> http://amusingprogrammer.blogspot.com/
>
>------------------------------------------------------------------------
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by DB2 Express
>Download DB2 Express C - the FREE version of DB2 express and take
>control of your XML. No limits. Just data. Click to get it now.
>http://sourceforge.net/powerbar/db2/
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Jump-pilot-devel mailing list
>Jump-pilot-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
>  
>


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to