Android Rxjava2 Memory Performance
I created an Observable(RxJava2 + Volley) that repeat for each 5 seconds, It works but when I Dump Java Heap(memory),there are many Instance of my Model JAVA class,and it will incr
Solution 1:
Why RX create several instance of my model? How can I use only ONE instance of it?
If you look carefully the object in the heapdump is LiveRemoteModel$2
which indicates it is an anonymous class within LiveRemoteModel
.
Looking at your code this is probably the VolleyStringRequest
object that gets created each time model.getLiveRefreshFuture()
is called. There is nothing retaining that object within the RX pipeline so there must be something within Volley retaining it.
Post a Comment for "Android Rxjava2 Memory Performance"