Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369350 - CMacroExpansionInput is referenced even if macro expansion is closed, wasting memory
Summary: CMacroExpansionInput is referenced even if macro expansion is closed, wasting...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 8.0.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Anton Leherbauer CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-22 21:07 EST by Marc-André Laperle CLA
Modified: 2012-02-29 13:21 EST (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-André Laperle CLA 2012-01-22 21:07:55 EST
Tested with 8.0.1 and master (2012-01-22)

1. Open several files with this code:

#define FOO(a) int a;
#define BAR(a) FOO(a);

int main() {
    BAR(myInt)
}

2. Hover over the second 'BAR' to get macro expansion steps. Do this in every file. *Do not close the files in the process*
3. Run GC.
4. Open Eclipse Memory Analyzer, acquire dump.
5. Open Dominator Tree, type CMacro in regex.
6. Notice several CMacroExpansionInputs still being referenced.

In a small project and small macro expansion, this is hardly noticeable. But when working on a large project with many files opened, I've seen this take 100MB+.

I think either the InformationControls should be closed and recreated every time or the input should be nulled out.
Comment 1 Anton Leherbauer CLA 2012-01-23 08:17:43 EST
(In reply to comment #0)
> I think either the InformationControls should be closed and recreated every
> time or the input should be nulled out.

The information controls are managed by the hover manager and cannot be disposed at will, but nulling the input when the controls are hidden makes sense.
I have done that in the master branch and verified that no CMacroExpansionInputs remains referenced.
Comment 2 Marc-André Laperle CLA 2012-01-24 20:06:31 EST
(In reply to comment #1)
> (In reply to comment #0)
> > I think either the InformationControls should be closed and recreated every
> > time or the input should be nulled out.
> 
> The information controls are managed by the hover manager and cannot be
> disposed at will,

Yeah, I had in mind modifying the hover manager but nulling the input works well.

> I have done that in the master branch and verified that no
> CMacroExpansionInputs remains referenced.

Thanks! I haven't seen any CMacroExpansionInput references since I applied the fix yesterday.
Comment 3 CDT Genie CLA 2012-02-29 13:21:57 EST
*** cdt git genie on behalf of Anton Leherbauer ***

    Bug 369350 - CMacroExpansionInput is referenced even if macro expansion is closed, wasting memory

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=8df0648343ce6283e92a6dd0c3eb6380a614a4cc