FileCapture node CV.:OutOfMemoryError

775 views
Skip to first unread message

Alejandro Cámera

unread,
Nov 13, 2019, 3:09:48 PM11/13/19
to Bonsai Users
Hello everyone!
We have been trying to do offline tracking in the lab and we stumbled with an memory error. I am attaching the bonsai script below, but this error also happens when we just use the FileCapture node. The error is: 

insufficient memory: failed to allocate 6220800 bytes in function cv.:OutOfMemoryError, alloc.cpp(52)

For what we have been reading this is an openCV error. The weird thing is that this error appears after tracking a few videos (it usually doesn't crash on the first one). We tried to monitor the memory usage of the PC and it seems that every time we run the bonsai script a part of the memory doesn't get released (maybe a leak?). The error usually appears when the free memory gets to low, but we have seen it happen with a lot of free memory also (attached picture: "free memory error"). Does this error happened to anyone else? Does anyone know a way to solve it? 
We are using bonsai 2.4, the computer has a procesor IntelCore i5 7200U @ 2.5GHz 2.7Ghz, 8Gb of RAM and we are running Bonsai on Windows 10 (64bit).
We also tried to go back to the portable bonsai 2.4preview and the error keeps appearing (although it migth be a little less frequent).
Our wokraround is to restart the computer after each video but sometimes it cannot even go trough one entire video. Videos are a bit heavy (each video last 3 minutes and weights  350MB)

Thanks for the help!
Free memory error.png
eye tracker.bonsai

Gonçalo Lopes

unread,
Nov 14, 2019, 7:44:43 AM11/14/19
to Alejandro Cámera, Bonsai Users
Hi Alejandro,

That is indeed very strange, especially if you are using the 64-bit version of Bonsai and your physical memory is not really exhausted in any way. In general, memory not being released right away by Bonsai is not necessarily a problem, as memory management depends on memory pressure, so often release of memory may not happen until something else requires it.

For some reason in your case the operating system is reporting a failure in allocating memory. Most often this is because of insufficient memory, but not always (the error message comes from OpenCV and I guess they always assume that this is the only reason for it, but technically there may be other reasons).

I'm not sure what exactly is happening in this case, since the workflow seems very simple so there is no obvious reason for allocation faults.

We would need to find a way to reproduce the problem reliably on different machines (maybe with a specific set of videos?). If you figure out more precisely which exact symptoms cause this, do let us know.

--
You received this message because you are subscribed to the Google Groups "Bonsai Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bonsai-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bonsai-users/f23d85fd-ab33-497d-b031-5b42d58cce65%40googlegroups.com.

LBLab

unread,
Jan 19, 2022, 4:15:52 PM1/19/22
to Bonsai Users
Dear Alejandro, 
I'm running into the same problemunfortunately. (I posted about it last week: https://groups.google.com/g/bonsai-users/c/wWJc1yf-HBE)

Do you remember how you solved the issue of running into the error "Insufficient memory: Failed to allocate ... bytes in function cv::OutOfMemoryError, alloc.cpp(52)"?
I have a pretty new PC with quite some computation power and don't know exactly if the problem is actual capacity or the way I'm trying to compute things in Bonsai.
I would be super grateful for your feedback!

Thanks a lot and best regards, 
Lisanne
Reply all
Reply to author
Forward
0 new messages