jjoe64 / GraphView

Android Graph Library for creating zoomable and scrollable line and bar graphs.
https://github.com/jjoe64/GraphView/wiki
Other
2.76k stars 811 forks source link

Memory leaks in real-time data when scrollToEnd is true #314

Open alexeyvasilyev opened 9 years ago

alexeyvasilyev commented 9 years ago

Steps to reproduce:

  1. Install Graph View demo from https://play.google.com/store/apps/details?id=com.jjoe64.graphview_demos
  2. Select Realtime Updates from the drawer.
  3. Run adb shell dumpsys meminfo com.jjoe64.graphview_demos Private dirty parameter will be constantly growing. Meaning that this is a memory leak in the app.

I see 22 MB leak within 2.5 minutes (from 70464 to 91116). See http://pastebin.com/4gYeP5BL

If scrollToEnd set to false there are no leaks.

jjoe64 commented 9 years ago

thanks a lot for the report, i will check

jjoe64 commented 9 years ago

it seems that it's not a memory leak. if you initiate GC it will correctly clear the heap. But maybe there is something to optimize anyway to reduce object creation

alexeyvasilyev commented 9 years ago

When I use in my app graph (almost the same code as in Realtime Updates) from version 4.0.0 I'm constantly getting out of memory crash in the app. Reverted to 3.1.4 version solved the problem. I'm still thinking that there is a memory leak inside.

jjoe64 commented 9 years ago

if you could provide me a complete project where i can reproduce it i can see. maybe the problem is on your app code side.