Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Ideas to reduce memory usage(Ideas to reduce memory usage)
Ideas to reduce memory usage [message #1017194] Sun, 10 March 2013 23:00 Go to next message
Luke V is currently offline Luke V
Messages: 1
Registered: January 2013
Junior Member
I'm using Sapphire to facilitate an XML entry for a design description and documentation format. The XML schema is rather complex (has many levels of hierarchy and is composed of multiple files). The schema comes from an standards committee and I cannot modify it for simplification.

I have a sapphire form/model put together and it works well for smaller xml files (< 256K). However as the files get larger, the load time grows and the memory usage starts to balloon. For a larger xml file (1-2MB), the load time opening the first form is a minute or two and eclipse's memory usage creeps into the 1200MB to 1500MB range. This tends to make eclipse less than responsive (even on a recent desktop machine with 12GB of RAM) and decreases the editor's usefulness. Sapphire 0.5x series would crash the JVM with the larger files. Sapphire 0.6 eventually loads, but is very slow. I've tried all sorts of JVM configuration tweaks, 1.6, 1.7, Hotspot, OpenJDK, and both Eclipse Indigo and Juno without any luck.

I've tried analyzing the issue a bit with the various memory profiler tools. From an initial look, it seemed that much of the utilization was due to creating a new service object for each node in the design. One quick idea was to try and figure out how to share a service object (or have a default one) for nodes that didn't customize the service at all. However, this seemed to be a bit of work (especially without a good working knowledge of Sapphire's internals).

Does anyone have an additional insight or ideas of how to reduce memory usage on designs with large numbers of model nodes?
Re: Ideas to reduce memory usage [message #1017451 is a reply to message #1017194] Mon, 11 March 2013 17:19 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 769
Registered: July 2009
Senior Member
Performance is definitely an issue that needs work, especially performance when opening an editor. Some work happened in the 0.6 release, but more is necessary. Typically, the issues are retention of objects that supposed to have gone out of scope (aka, memory leak) or unnecessary repetition of work (too many events). The memory weight of legitimate objects is unlikely to be an issue.

If you are poking around with a profiler, take a look at object counts on the heap for some of the key classes (such as MasterDetailsContentNode). Does the count match your expectation?

Any help you can offer in diagnosing performance issues would be of great benefit to the project.

- Konstantin
Re: Ideas to reduce memory usage [message #1018088 is a reply to message #1017451] Wed, 13 March 2013 01:40 Go to previous messageGo to next message
Greg Amerson is currently offline Greg Amerson
Messages: 77
Registered: March 2010
Member
Hey Konstantin,

I took a few hours yesterday to poke around with some sampling. I saw a few hot spots in the EL parsing and ExtensionSystem initialization. I modified to the code to cache EL function literals and also removed synchronization and switched to eager init for the ExtensionSystem to remove need for sychronization. Then the next hotspots I found were equally divided in the ModelElement.read() and that gets into the heart of the framework so I stopped my attempts there. So after my 2 changes, I'm still not seeing any overall speed ups for opening the editor. Before my changes, i was about from 11-13 seconds opening a 82k xml file and after my changes i'm seeing speeds within statistical variation. I can send you a patch for the changes if you wanted to review but at this time, I don't think the changes are quite worth it.

However, this startup speed issue is something that my users have been reporting. Now granted, some of the slowness could be due to my usage of the framework and could be optimized. But I am willing to commit resources to addressing this problem.
Re: Ideas to reduce memory usage [message #1018315 is a reply to message #1018088] Wed, 13 March 2013 11:55 Go to previous message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 769
Registered: July 2009
Senior Member
I fixed a number of performance issues for the 0.6 release using a combination of two techniques. I am sure more cases of both are still present.

1. Used a heap analyzer (such as Eclipse MAT) to look for lingering objects or too many objects of particular type. Memory leaks is the most likely culprit of high memory usage.

2. Used the trace facility in the event system to identify cases where too many events were generated and processed. This is the most likely culprit of slow editor startup. See ListenerContext.TRACE and Event.TRACE_SOURCE_STACK_DEPTH. This analysis is best performed with a very small editor and a very small model instance.

- Konstantin
Previous Topic:Monitoring adds/removes to a ModelElementList
Next Topic:potential workaround for startup speed issue
Goto Forum:
  


Current Time: Wed May 22 16:42:01 EDT 2013

Powered by FUDForum. Page generated in 0.04004 seconds