Hi Edgar, > without looking at it, just reading what you say you did... i am not sure > that the approach 100% proper. from a user perspective deleting a layer > should be undoable, which does not seem to be the case in your scenario.
Has "deleting a layer" to be undoable is a good question. In my fix, I just tried to improve current situation (deleting a layer was not undoable, throwed exception and could retain a lot of memory), not to complete the undo capabilities. I do not think that adding undo to "delete a layer" is viable in OpenJUMP, because adding/deleting layers is a very common action and keeping all layers in the undo chain would consume too much memory (but I agree that this would be the ideal behaviour from a user perspective). Maybe it would be doable if deleted layers were automatically persisted and restored by the undo mechanism... > regarding undo memory use - there is a reset the whole undo queue > functionality, that could be exposed via plugin as a menu/toolbar entry. Adding a button to clear the undo chain would be useful (but understanding the undo mechanism to deactivate and free the memory of edits related to deleted layers took me the whole week-end :-( Regards, Michaël > > ..ede > > > On 20.01.2013 19:55, Michaël Michaud wrote: >> Hi all, >> >> I just made two fixes which should solve the memory leaks observed by Jukka >> (r3247). >> >> *First is a one-line fix in AddNewFeaturesPlugIn* which retained the whole >> text added as WKT. >> Now EnterWKTDialog free the resources before returning. >> >> *Second is a much larger fix on undo/redo mechanism* with possible side >> effects. >> Here is how it used to work : >> - modify layer A >> - modify layer B >> - modify layer C >> - remove layer B >> - undo : undo modification on layer C >> - undo : throws an exception (try to modifiy a layer which has been removed) >> >> The modification : >> Now, a UndoableCommand can be linked to a Layer. >> In that case, a listener is added to deactivate the command if the Layer is >> removed : >> It is not possible to remove the command from the undo stack (I could not >> find a way) but it is possible to free resources related to the modification >> and to deactivate the command so that it is skipped. >> >> Some modifications work on the whole workbench, some have to done >> where new UndoableCommand are created (work in progress). >> Now : >> - modify layer A >> - modify layer B >> - modify layer C >> - remove layer B >> - undo : undo modification on layer C >> - undo : undo modification on layer A >> >> One possible side effect is a slow down of the whole system, >> because listeners added to each single command are listening all feature >> events and all layer events. >> >> Please, try and report, >> >> Michaël >> >> >>> Good observations MM. >>> >>> Does OJ currently have a way to clear the undo queue? >>> >>> If not, I might look into to adding that functionality next week. >>> >>> Landon >>> >>> On Sat, Jan 19, 2013 at 4:40 AM, Michaël Michaud >>> <michael.mich...@free.fr> wrote: >>>> Hi Jukka, >>>> >>>> I started analysing the problem and I think there are different >>>> things in your observations. >>>> >>>> 1) features kept in the undo stack. Yes, they are. I think this is the >>>> normal behaviour as you may want to undo the "add wkt geometry" >>>> action, but in this case, this takes a lot of memory. >>>> 2) undo data related to a layer is probably not released when the layer >>>> is removed (your observation). This is a bug. Another consequence is >>>> that an exception is thrown if you undo an action adding features to a >>>> layer which does not exists any more. >>>> I'll try to fix this bug, but It's not very simple, so let's see... >>>> 3) The slowness of right click on a layername seems to be related to the >>>> windows clipboard, not the openjump undo stack. If you empty the >>>> clipboard (just select an empty string), openjump behaves normally >>>> again. I don't think it is necessary to go further with this one. >>>> >>>> Regards, >>>> >>>> Michaël >>>> >>>> >>>>> Hi, >>>>> >>>>> My data were just polygons from BBOXes. I believe you can make the first >>>>> test by making 200000 copies of one polygon with a text editor and >>>>> copy-paste them all into WKT input box. >>>>> POLYGON ((40 280, 40 320, 80 320, 80 280, 40 280)) >>>>> >>>>> -Jukka- >>>>> >>>>> Landon Blake wrote: >>>>> >>>>>> Jukka: >>>>>> Can you send me you data so I can do some testing. >>>>>> I remember this same issue being raised on the mailing list before, >>>>>> and I thought it had been corrected. Maybe not. At any rate, I'd like >>>>>> to do some poking around with the data you are using to see if I can >>>>>> verify a problem. >>>>>> Landon >>>>> On Fri, Jan 18, 2013 at 7:10 AM, Rahkonen Jukka >>>>> <jukka.rahko...@mmmtike.fi> wrote: >>>>>> Hi, >>>>>> >>>>>> While playing with BBOXes converted into polygons I noticed that OJ does >>>>>> not work extremely well after pasting for example 200000 polygons as WKT >>>>>> from clipboard into the WKT input box. The conversion into OJ features >>>>>> is surprisingly fast, but after the polygons have been inserted into the >>>>>> layer there are some issues. >>>>>> >>>>>> - A lot of memory is reserved and Garbage collect does not free it. Even >>>>>> deleting the layer does not help. I guess that features are kept in undo >>>>>> buffer or something. Perhaps we should have a button for clearing the >>>>>> Undo? >>>>>> - Right click context menu does not work for layers in the Table of >>>>>> content. It does work for layer groups, but slowly. >>>>>> >>>>>> -Jukka Rahkonen- >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and >>>>>> much more. Get web development skills now with LearnDevNow - >>>>>> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. >>>>>> SALE $99.99 this month only -- learn more at: >>>>>> http://p.sf.net/sfu/learnmore_122812 >>>>>> _______________________________________________ >>>>>> Jump-pilot-devel mailing list >>>>>> Jump-pilot-devel@lists.sourceforge.net >>>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>> ------------------------------------------------------------------------------ >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >>>>> MVPs and experts. SALE $99.99 this month only -- learn more at: >>>>> http://p.sf.net/sfu/learnmore_122912 >>>>> _______________________________________________ >>>>> Jump-pilot-devel mailing list >>>>> Jump-pilot-devel@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>> >>>>> ------------------------------------------------------------------------------ >>>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >>>>> MVPs and experts. SALE $99.99 this month only -- learn more at: >>>>> http://p.sf.net/sfu/learnmore_122912 >>>>> _______________________________________________ >>>>> Jump-pilot-devel mailing list >>>>> Jump-pilot-devel@lists.sourceforge.net >>>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>>>> >>>>> >>>> ------------------------------------------------------------------------------ >>>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >>>> MVPs and experts. SALE $99.99 this month only -- learn more at: >>>> http://p.sf.net/sfu/learnmore_122912 >>>> _______________________________________________ >>>> Jump-pilot-devel mailing list >>>> Jump-pilot-devel@lists.sourceforge.net >>>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>> ------------------------------------------------------------------------------ >>> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >>> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >>> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >>> MVPs and experts. SALE $99.99 this month only -- learn more at: >>> http://p.sf.net/sfu/learnmore_122912 >>> _______________________________________________ >>> Jump-pilot-devel mailing list >>> Jump-pilot-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, >> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current >> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft >> MVPs and experts. ON SALE this month only -- learn more at: >> http://p.sf.net/sfu/learnmore_123012 >> >> >> >> _______________________________________________ >> Jump-pilot-devel mailing list >> Jump-pilot-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel >> > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnmore_123012 > _______________________________________________ > Jump-pilot-devel mailing list > Jump-pilot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel > > ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. ON SALE this month only -- learn more at: http://p.sf.net/sfu/learnmore_123012 _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel