MobiVM / robovm

Ahead of time compiler for JVM bytecode targetting iOS, Mac OSX and Linux
https://mobivm.github.io
967 stars 133 forks source link

* Memory usage optimization (1/2): release not required data asap #650

Closed dkimitsa closed 2 years ago

dkimitsa commented 2 years ago

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 argument

Results achieved:

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.

dkimitsa commented 2 years ago

more info and charts in post