Reputation: 13283
Is there any way to stop the garbage collector for some time?
Upvotes: 10
Views: 9474
Reputation: 6012
The best way of not be lagged by the GC is to avoid the need to collect garbage all the time. You could for example reuse objects instead of nulling them and creating new ones. This quite same pattern as androids CursorAdapter is doing when reusing the View's, it just reused a view to represent new data. The drawback of this that you have to do it manually and program in a very precise way. Also you'll get a better memory handling and a performance boost.
Upvotes: 9