Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313379 - [run control] Restarting the program causes memory leak
Summary: [run control] Restarting the program causes memory leak
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-18 11:34 EDT by Marc Khouzam CLA
Modified: 2020-09-04 15:26 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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).