On Android, is there any way to stop the garbage collector for some time? I need this because I have some lags in my animation. If their is no way, can I force the garbage collector to run at some specific time (for example when my animation is pausing) ?
Asked
Active
Viewed 65 times
0
-
No, Oreo is future. – rupinderjeet Feb 01 '18 at 08:22
-
No. you can 'request' the GC to run, but the GC will 'decide' on it's own whether or not to comply. calling GC.run does not guarantee it also will. – Stultuske Feb 01 '18 at 08:23
-
1You really think garbage collector is reason for laggy animation? – unalignedmemoryaccess Feb 01 '18 at 08:23
-
Every apps without laggy animation have to use default gc behave too. – Sraw Feb 01 '18 at 08:29
-
@tilz0R i not sure but i would like to remove this hypothese from the table ;) – zeus Feb 01 '18 at 08:29
-
@loki, I would says you have a problem with your coding (architecture) approach. Garbage collector in low-level thing, which does not influence you code almost nothing. – unalignedmemoryaccess Feb 01 '18 at 08:32
-
You can be sure that this isn't related to garbage collection. You should inspect your code for possible issues or - if you don't see any - ask here what could cause the lagging (with the relevant code included). – simon Feb 01 '18 at 08:35
-
at least is their anyway to know when the garbage collector is done (and i can see if my lags is because of the garbage collector) ? i m not an android studio, i m building a native app with Delphi – zeus Feb 01 '18 at 08:38
-
1also from https://developer.android.com/training/articles/perf-tips.html : "As you allocate more objects in your app, you will force a periodic garbage collection, creating little "hiccups" in the user experience." – zeus Feb 01 '18 at 08:41
-
to everyone, i just did the test and i have now absolutely no doubt that the lag i saw in my animation are caused by GC or something similare – zeus Feb 01 '18 at 14:06
-
*or something similar* ... so you don't actually know whether it was the GC. – the8472 Feb 01 '18 at 19:31