GRIP icon indicating copy to clipboard operation
GRIP copied to clipboard

Webcam source memory leak

Open johnyburd opened this issue 8 years ago • 17 comments

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 avatar Jan 11 '17 15:01 johnyburd

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

johnyburd avatar Jan 11 '17 17:01 johnyburd

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

SamCarlberg avatar Jan 11 '17 18:01 SamCarlberg

10GB

johnyburd avatar Jan 11 '17 18:01 johnyburd

And what version of GRIP?

SamCarlberg avatar Jan 11 '17 18:01 SamCarlberg

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

johnyburd avatar Jan 11 '17 18:01 johnyburd

The version is the latest from GitHub

johnyburd avatar Jan 11 '17 18:01 johnyburd

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

SamCarlberg avatar Jan 11 '17 18:01 SamCarlberg

1.5.1

johnyburd avatar Jan 11 '17 18:01 johnyburd

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

SamCarlberg avatar Jan 11 '17 18:01 SamCarlberg

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

johnyburd avatar Jan 11 '17 18:01 johnyburd

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.

SamCarlberg avatar Jan 11 '17 18:01 SamCarlberg

Having the same issue on Debian Stretch

thomassross avatar Jan 12 '17 21:01 thomassross

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

SamCarlberg avatar Jan 13 '17 21:01 SamCarlberg

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

thomassross avatar Jan 13 '17 21:01 thomassross

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

thomassross avatar Jan 23 '17 21:01 thomassross

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

SamCarlberg avatar Jan 24 '17 18:01 SamCarlberg

Just a note:

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

NickLD avatar Feb 13 '17 13:02 NickLD