| Summary: | GroupRequest#setEditPart(EditPart part) does not take care of memory | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] GEF | Reporter: | Mariot Chauvin <mariot.chauvin> | ||||||||||||
| Component: | GEF-Legacy GEF (MVC) | Assignee: | Alexander Nyßen <nyssen> | ||||||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||||||
| Severity: | normal | ||||||||||||||
| Priority: | P3 | CC: | hudsonr, nyssen | ||||||||||||
| Version: | 3.2.1 | ||||||||||||||
| Target Milestone: | 3.10.0 (Mars) M1 | ||||||||||||||
| Hardware: | All | ||||||||||||||
| OS: | All | ||||||||||||||
| Whiteboard: | |||||||||||||||
| Attachments: |
|
||||||||||||||
Can you please provide data showing the memory problem and the differences made by the proposed change? Created attachment 87741 [details]
example project
Created attachment 87742 [details]
screenshot of current implementation debug
Created attachment 87743 [details]
screenshot 2 of current implementation debug
Created attachment 87744 [details]
screenshot of better implementation debug
Created attachment 87745 [details]
screenshot 2 of better implementation debug
I uploaded a very small example projet you can debug, to see the difference. If you do not have time to do it, I uploaded too 4 screenshots showing the difference. If you still don't see the benefit please have a look to : http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html#trimToSize() I understood that the patch saves 9 words per GroupRequest during single selection. But unless you have 10,000 GroupRequests in memory, how is this even a blip on the radar? I was hoping perhaps you had done some memory profiling in a tool like YourKit that showed substantial use of some application's memory was being consumed by GroupRequests. Ensure GroupRequest#setEditParts(EditPart) creates array list with initial capacity of 1. Fix pushed to origin/master. Resolving as fixed in 3.10.0M1 |
Current implementation is : public void setEditParts(EditPart part) { parts = new ArrayList(); parts.add(part); } The default ArrayList constructor use a table wth an initial capacity of 10 ! A more memory friendly implementation will be : public void setEditParts(EditPart part) { parts = new ArrayList(0); parts.add(part); }