Fix for robovm being quite memory hungry. Example project with 30K classes:
during compilation required up to 6.5Gb of heap;
once compilation is finished and app started on simulator -- was consuming 3.4Gb of heap.
(2nd June update) Reworked into compiler plugin
Issue discovered in Framework target: class information was required to build list of NSObject subclasses for registration but at this moment soot was disposed
Reworking into plugin fixed this issue as we follow plugin notification cycle and GC plugin is called last.
Also having it as plugin allows to disable this functionality through robovm.xml by using buildGC:enable=false plugin argument
Results achieved:
4GB heap settings is enough to compile sample project;
most consuming moment was about 2.7 GB after garbage collector;
when compilation is complete and app is started memory usage is ~300MB (UI responsible, debugger happy);
compilation time (31601 classes): reduced from 506.72 (8GB heap) to 394.75 (4GB heap) seconds.
Problems divided into two categories.
post compilation pressure:
Soot was keeping all parsed classes in singleton. Solution -- reset soot after compilation
Lot of structures were kept in Clazzes/Config that are not required after compilation. Solution -- dispose these once not required.
in compilation pressure -- most memory consuming.
Soot -- once class is processed, no need to keep its parsed Body.
ClazzInfo -- no need to keep dependency map for it once it processed through dependency trie;
To exclude usage of classes in disposed state corresponding checks were added that might cause IllegalStateException if misused.
fix for #150
Fix for robovm being quite memory hungry. Example project with 30K classes:
(2nd June update) Reworked into compiler plugin
Issue discovered in Framework target: class information was required to build list of NSObject subclasses for registration but at this moment soot was disposed
Reworking into plugin fixed this issue as we follow plugin notification cycle and GC plugin is called last. Also having it as plugin allows to disable this functionality through robovm.xml by using
buildGC:enable=false
plugin argumentResults achieved:
506.72 (8GB heap)
to394.75 (4GB heap)
seconds.Problems divided into two categories.
post compilation pressure:
in compilation pressure -- most memory consuming.
To exclude usage of classes in disposed state corresponding checks were added that might cause IllegalStateException if misused.