summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorSimon Delisle2013-08-14 14:35:31 (EDT)
committer Alexandre Montplaisir2013-08-15 14:10:54 (EDT)
commit82d4e5fae2b1acb4becfc5d3360248eff9164937 (patch)
tree332778e6ffe8ae0228c69191a3be9275ccce29e6
parent5816011168a5c317c58ff62b9f41e32be4acd319 (diff)
downloadorg.eclipse.linuxtools-82d4e5fae2b1acb4becfc5d3360248eff9164937.zip
org.eclipse.linuxtools-82d4e5fae2b1acb4becfc5d3360248eff9164937.tar.gz
org.eclipse.linuxtools-82d4e5fae2b1acb4becfc5d3360248eff9164937.tar.bz2
Ctf: add removeIterator() to prevent OutOfMemory exception (Bug 414998)refs/changes/87/15487/4
Change-Id: I0a42a1b4d7eb14b37bc97471dba1b4aae44d2f4c Signed-off-by: Simon Delisle <simon.delisle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/15487 Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im> IP-Clean: Alexandre Montplaisir <alexmonthy@voxpopuli.im> Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java25
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java6
2 files changed, 28 insertions, 3 deletions
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
index 2d85af8..65fac21 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfIteratorManager.java
@@ -6,7 +6,9 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Matthew Khouzam - Initial API and implementation
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Delisle - Added a method to remove the iterator
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
@@ -71,6 +73,22 @@ public abstract class CtfIteratorManager {
final CtfTmfContext ctx) {
return map.get(trace).getIterator(ctx);
}
+
+ /**
+ * Remove an iterator for a given trace and context
+ *
+ * @param trace
+ * the trace
+ * @param ctx
+ * the context
+ * @since 2.1
+ */
+ public static synchronized void removeIterator(final CtfTmfTrace trace, final CtfTmfContext ctx) {
+ CtfTraceManager traceManager = map.get(trace);
+ if (traceManager != null) {
+ traceManager.removeIterator(ctx);
+ }
+ }
}
/**
@@ -154,6 +172,11 @@ class CtfTraceManager {
return retVal;
}
+ public void removeIterator(CtfTmfContext context) {
+ fMap.remove(context);
+ fRandomAccess.remove(context);
+ }
+
/**
* Add a pair of context and element to the hashmap and the arraylist.
*
diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java
index b1ef6d7..df2076b 100644
--- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java
+++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfContext.java
@@ -6,7 +6,9 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Matthew Khouzam - Initial API and implementation
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Delisle - Remove the iterator in dispose()
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.ctfadaptor;
@@ -137,7 +139,7 @@ public class CtfTmfContext implements ITmfContext {
@Override
public void dispose() {
- // do nothing
+ CtfIteratorManager.removeIterator(fTrace, this);
}
/**