| Summary: | Some Stdlib-Extensions cause memory leaks | ||
|---|---|---|---|
| Product: | [Modeling] M2T | Reporter: | Jochen Schmich <jochen.schmich> |
| Component: | Xpand | Assignee: | Karsten Thoms <karsten.thoms> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | karsten.thoms, sebastian.zarnekow, sven.efftinge |
| Version: | unspecified | Keywords: | helpwanted |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 361452 | ||
|
Description
Jochen Schmich
A contribution (patch) would be most welcome :-) I've exemplary fixed this for the counter extension. I think most of these things could be handled using the same base class. Sorry, can't contribute a patch that fast - my company firewall keeps my from checking out the source code. Well... i'll try it this way to contribute my hacks:
public class CounterExtensions {
private static int globalCounter = 0;
private static Map<Object,Integer> vars = new HashMap<Object,Integer>();
...
public static void shutdown() {
if(vars != null) {
vars.clear();
}
}
}
public class ElementPropertiesExtensions {
private static Map<Object, Map<String,Object>> outerMap = null;
...
public static void shutdown() {
if(outerMap != null) {
outerMap.clear();
outerMap = null;
}
}
}
The other way would change the visibility of the static fields, to enable a subclass to clear the Maps... Thanks for fixing the CounterExtensions -> and thanks for introducing a better solution than my hacks were! Going to test against the current Build. Also these classes are affected: - GlobalVarExtensions - PropertiesExtensions - TraceComponent - UIDHelper Fixed: - ElementPropertiesExtensions - GlobalVarExtensions - UIDHelper by extending AbstractStatefulExtension PropertiesExtensions and TraceComponent remain. The problem is here that data is exchanged between the Workflow Component and the extensions. There is currently no way to access the WorkflowContext from an extension class. Also the ExecutionContext cannot be used. For ElementPropertiesExtensions it is necessary to support the static map for storage as an alternative, since a major customer project is unfortunately relying on the fact that properties are preserved over multiple workflow executions. Therefore this class will get a legacy mode, which has to be enabled by invoking ElementPropertiesExtensions.setLegacyMode(true). If legacy mode is enabled, the static map gets instantiated and storage of properties will go there. If set to 'false', the map is removed again. This also enables to clean up the memory that the static storage causes. This way also legacy code can avoid the memory leak. ElementPropertiesExtension legacy mode introduced with commit# 1611cc2f47d064646bf098facc1e4156a4e537a7 For backward compatibility legacy mode must be added for the other refactored extension classes also (i.e. GlobalVarExtensions, PropertiesExtensions). The commit from comment #7 broke backwards compatibility with existing clients. Any reason why the API tooling of Eclipse is not used for Xpand? API tooling was set up recently, after that time. (In reply to comment #12) > API tooling was set up recently, after that time. That's unfortunate, but a copy'n paste of the old code allowed to fix the existing projects. Not too nice, but probably not a show-stopper. I suggest to close this ticket rather than leaving it in the ASSIGNED state any longer. There are still components that cause memory leaks (esp. TraceComponent). And with the current code base it is not possible to fix these components. I would like to close this ticket, but this would just mean I would have to open another one for the remaining components. This is a batch close of open M2T Xpand bugs. It is not planned work on this component in the foreseeable future. If you think this issue needs to be solved and you plan to contribute a fix then feel free to reopen it. |