WPIRoboticsProjects / GRIP

Program for rapidly developing computer vision applications
http://wpiroboticsprojects.github.io/GRIP
Other
379 stars 107 forks source link

Webcam source memory leak #783

Open johnyburd opened 7 years ago

johnyburd commented 7 years ago

The title pretty much says it all.

memory webcam

Whenever I have webcam selected as the source, the memory usage constantly goes up until my computer crashes. I'm running arch linux and this happens with or without a preview selected.

johnyburd commented 7 years ago

I saw on the raspberry pi page that there was a bug with USB webcams, but I have also reproduced this on an HTTP stream and even a static image

SamCarlberg commented 7 years ago

How much memory do you have installed? GRIP is configured to use up to 200MB on the Java heap but will tend to use more overall due to OpenCV's native memory use

johnyburd commented 7 years ago

10GB

SamCarlberg commented 7 years ago

And what version of GRIP?

johnyburd commented 7 years ago

I also noticed the find line, contour, and blob modules all agrevate the problem.

johnyburd commented 7 years ago

The version is the latest from GitHub

SamCarlberg commented 7 years ago

If you go to the Help > About menu, what version does it report?

johnyburd commented 7 years ago

1.5.1

SamCarlberg commented 7 years ago

Then it's most likely a problem with Arch. I can't reproduce this on Elementary OS

johnyburd commented 7 years ago

That is very strange. Any work around that isn't changing Os's?

SamCarlberg commented 7 years ago

If you have a JDK installed, you can launch VisualVM to see how much of the heap is being used and how large the heap is. If the heap is small (< 50%) compared to the total memory use you see in the system monitor, then OpenCV objects aren't getting cleaned up.

thomassross commented 7 years ago

Having the same issue on Debian Stretch

SamCarlberg commented 7 years ago

@thomassross are you building with Gradle or using the native app from our releases page?

thomassross commented 7 years ago

@SamCarlberg I'm using the latest deb package on the releases page.

thomassross commented 7 years ago

I am not getting this issue with a static image instead of a webcam.

SamCarlberg commented 7 years ago

That's expected. Changing images allocates more memory. If you're comfortable with it, you can install VisualVM and the GC plugin for it. Garbage collection should be running about once per second

NickLD commented 7 years ago

Just a note:

Can confirm this issue occurs with Lubuntu and fills up the 8 GB of RAM on our Vision system within Minutes.