Hi,

we developed a plugin which starts a large number of profilingSessions
programmatically (Profile As -> JUnit Test). The problem is, each
traceModel is   has its size (in memory) and eclipse runs OutOfMemory
after a while.

To solve that our first approach is like this:

- start ProfilingSession
- store TRCAgent (given by handleProfileEvent)
- do evaluations on the model
- remove the model from memory
- start new ProfilingSession
- ...

We implemented the deleteMethod like this:

// before creating a new traceModel delete the previous one to save memory
public void deletePreviousTrcModel(final TRCAgent trcAgent) {
        EzUnitPlugin.trace("delete previous trace model");
        if (trcAgent != null) {
                WorkspaceJob delete = new WorkspaceJob(
                                "delete previous trace model ...") {
                        @Override
                        public IStatus runInWorkspace(IProgressMonitor arg0)
                                        throws CoreException {
                                long deleteTime = System.currentTimeMillis();

                                // delete the old resource object ...
                                Set deletedElements = null;
                                try {
                                        deletedElements = 
EMFUtil.delete(trcAgent.getProcess());
                                } catch (Exception anyException) {
                                        // do nothing else ... just report this 
error!
                                        EzUnitPlugin.logWarn("error while 
deleting traceModel",
                                                        anyException);
                                }
                                EzUnitPlugin.trace("deletion of "
                                                + (deletedElements != null ? 
deletedElements.size()
                                                                : -1)
                                                + " element took "
                                                + 
String.valueOf(System.currentTimeMillis()
                                                                - deleteTime) + 
"ms");
                                return Status.OK_STATUS;
                        }
                };
                delete.schedule();
        }
}


Now the memory usage does not grow so fast, but it still grows. So my
assumptions is that i still leave some (big) object left in the model.
Furthermore some NPE occur after the deleteMethod has been called:

Thread[TCPDataFlusher,8,main] - java.lang.NullPointerException
        at
org.eclipse.hyades.loaders.trace.TraceUtils$InvocationInfo.initInvocationInfo(TraceUtils.java:837)
        at
org.eclipse.hyades.loaders.trace.TraceUtils$InvocationInfo.update(TraceUtils.java:938)
        at
org.eclipse.hyades.loaders.trace.TraceUtils$InvocationPool.allocInvocation(TraceUtils.java:972)
        at
org.eclipse.hyades.loaders.trace.XMLmethodEntryLoader.processENI(XMLmethodEntryLoader.java:124)
        at
org.eclipse.hyades.loaders.trace.TraceXMLFragmentLoader.dispatchProcessMode(TraceXMLFragmentLoader.java:450)
        at
org.eclipse.hyades.loaders.trace.XMLmethodEntryLoader.addYourselfInContext(XMLmethodEntryLoader.java:67)
        at 
org.eclipse.hyades.loaders.util.XMLLoader.endElement(XMLLoader.java:310)
        at
org.eclipse.hyades.loaders.util.SAXFragmentHandler$RegularHandler.endElement(SAXFragmentHandler.java:175)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown 
Source)
        at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
        at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown 
Source)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
        at
org.eclipse.hyades.loaders.util.SAXFragmentHandler.parse(SAXFragmentHandler.java:128)
        at
org.eclipse.hyades.loaders.util.SAXFragmentHandler$1.run(SAXFragmentHandler.java:65)


At least this my question: Could give some pointers where to find
information regarding the _complete_ programmatic deletion of model
objects? Do i probably use the wrong container to delete?

Any help is greatly appreciated. Many thanks in advance,

Thomas E.-E.



_______________________________________________
tptp-tracing-profiling-tools-dev mailing list
tptp-tracing-profiling-tools-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/tptp-tracing-profiling-tools-dev

Reply via email to