Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 313379

Summary: [run control] Restarting the program causes memory leak
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Project Inbox <cdt-debug-dsf-gdb-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: minor    
Priority: P3 CC: pawel.1.piech
Version: 7.0   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Marc Khouzam CLA 2010-05-18 11:34:08 EDT
When we to a Restart operation, we re-create the GDBInferiorProcess, but we don't dispose of the old one, which surely leads to memory leaks.
Comment 1 Marc Khouzam CLA 2010-05-18 11:35:58 EDT
I thought the solution would simply be to call MIInferiorProcess#dispose() before creating the new one, but it was not that easy.

MIInferiorProcess#dispose() calls setState(State.TERMINATED) which makes the launch believe that gdb is terminated.

We'll have to look into if this call to setState() should be in dispose() or not.

This is not urgent.
Comment 2 Marc Khouzam CLA 2011-05-17 15:49:19 EDT
With the recent changes to MIInferiorProcess, there is no longer a memory leak.  Once the debug session is terminated, all MIInferiorProcess classes will be disposed.

However, it would be better to call dispose() whenever a process is terminated, to avoid having those objects linger around when they are not used anymore.

We should probably simply call dispose() instead of setTerminated() in MIInferiorProcess.  I am just worried about closing the streams to early.  I'd have to give it more thought and testing, which is too late for Indigo (and not important enough).