Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[m2m-atl-dev] ASMEMFModel Memory leak comes back to haunt?

Hello devs,

Recently, the "extent.unload()" line was removed from ASMEMFModel's dispose method. Calling "unload()" should indeed not be necessary, and removing a Resource from its ResourceSet should suffice.

Some tests with running ATL via Ant on some UML2 models revealed that, even though ATL's ResourceSet never grew larger, memory was leaking at about 20MB per Ant run. I also found that a couple of models (profiles, libraries) were not removed from the ResourceSet afterwards, because ATL is not aware of them.

The problem in ATL is that we're constantly trying to clean up ATL's static ResourceSet, while EMF happily auto-resolves and auto-loads referenced models. I've committed a new branch to the ATL CVS ("ATL_Dynamic_ResourceSet") that uses dynamic ResourceSet instances, which are coupled to ModelLoader instances. This required breaking the existing API for loading/saving models. I've used that as an opportunity to remove all unused and/or duplicated API for loading and saving.

AtlModelHandlers no longer include model loading/saving methods. Instead, they have a Factory Method for creating ModelLoaders. A ModelLoader instance can be used for a single ATL run (or a chain of ATL runs). Afterwards, the ModelLoader will be garbage collected, with ResourceSet and all. Models no longer need to be explicitly disposed: this functionality has been moved to the "finalize()" method of the ModelLoader, which is automatically invoked by the garbage collector. The code still uses "unload()", but at least it is only used in the garbage collection thread and doesn't interfere with the main model transformation algorithms.

Cheers,
--
Dennis Wagelaar



Back to the top