Bug 279458 - Memory Leak in Intermediate Properties
Summary: Memory Leak in Intermediate Properties
Status: NEW
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-08 09:13 EDT by Alexander Igdalov CLA
Modified: 2009-09-01 06:56 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Igdalov CLA 2009-06-08 09:13:37 EDT
Consider the example below.

modeltype ECORE "strict" uses ecore('http://www.eclipse.org/emf/2002/Ecore');

transformation NewTransformation(in eModel : ECORE, out outModel : ECORE);

intermediate property EPackage::y : String;

main() {
        while (i : Integer := 0; i < 1000000) {
                var pack := object EPackage {
                        y := 'aaa';
                };
                outModel.removeElement(pack);
        }
}

Currently, it causes a memory leak. 

While this is arguable, such pattern might be preferred for creation of multiple temporary data in computational transformations. This is because intermediate class instances are stored in the intermediate extent and thus, are not collected by the GC until the transformation has finished which might cause out-of-memory errors.

To resolve this bug, I would make the IntermediatePropertyModelAdapter.ShadowEntry.myOwner2ShadowMap field a weak identity hash map. See also bug 279251.