-
I wonder if it's related to Volley.newRequestQueue - maybe that should just be called once?
I think that's it: looking at this, we should either call
stop()
on the queue once we have a response, or set up a singleton. Otherwise every request leaves a new "thread pool" lying about.If you just need to make a one-time request and don’t want to leave
the thread pool around, you can create theRequestQueue
wherever you
need it and callstop()
on theRequestQueue
once your response or
error has come back, using theVolley.newRequestQueue()
method
described in Sending a Simple Request. But the more common use case is
to create theRequestQueue
as a singleton to keep it running for the
lifetime of your app, as described in the next section.(Calling
stop()
seems by far the easiest solution.)
Oh wow, that's huge.
It is possible there's a memory leak, yes. I keep an eye on Bangle.js itself but a leak on the Android side is not something I've tested for myself.
I'm not an Android developer so I'm not sure I can really be more help than Google about how to track it down... I think you'd have to do your own build, but the code responsible for the HTTP request is https://codeberg.org/Freeyourgadget/Gadgetbridge/src/branch/master/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/banglejs/BangleJSDeviceSupport.java#L591-L701
I wonder if it's related to
Volley.newRequestQueue
- maybe that should just be called once?I'm afraid I'm on holiday next week so I'm not going to be able to help tracking this down until my return though