Some form of memory leak

Report crashes, strange behaviour, or apparent bugs
kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

Some form of memory leak

Post by kleinash »

V-REP will run fine for a while, days even. My simulation takes days to record all the data. After some time the remote API crashes and my entire computer slows to a standstill - it's a high-performance computer so it shouldn't. Its like there is some form of memory leak. I restart V-REP and things run fine again, but I am not getting to the end of my simulation. Should I be looking to clear cache? does it have something to do with the XServer? Has there been anything like this before could it be the remote API through MatLab?

Here is a screen shot of my htop output:
https://www.dropbox.com/s/0rd0mdzbddggh ... 1.png?dl=0

Ubuntu 16.04
MatLab R2013b
V-REP 3.4.0

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Some form of memory leak

Post by coppelia »

Hello,

difficult to say what is going on. Can you verify that V-REP's memory consumption is steadily growing until it crashes? And does the remote API client crash before? Will it also crash if the remote API is not used (probably more difficult to test if lots of logic is located on the matlab side). Which one crashes first? Matlab (i.e. the remote API client) or V-REP? Dos the Matlab memory consumption steadily grow?

Cheers

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

Re: Some form of memory leak

Post by kleinash »

This is after running overnight:
https://www.dropbox.com/s/k1y1fjzwzaa5f ... 2.png?dl=0

I will check every few hours and do the same screen shot to see what's happening and if the memory usage is building, my feeling is that it is and that it's something with XServer - It seems to use a lot of memory as it is. Is there a way to reduce that? It doesn't look like MatLab memory grows at all, and if it's using more memory it's very slightly. I don't have to kill Matlab to restart, only V-REP.

More info is that I have to run in headless mode because V-REP will segfault first and MatLab then crashes if I run with full GUI. So I run in headless mode only (I save images to make sure everything is happening as it should though).

V-REP doesn't crash in headless mode, only MatLab. If it happens again (which is likely) I will send the error message - but I have seen it enough times now to know it's that it cannot communicate with V-REP.

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

Re: Some form of memory leak

Post by kleinash »

and after a day of running:

https://www.dropbox.com/s/i3oi9lctkza3t ... 3.png?dl=0
https://www.dropbox.com/s/hfszlnaahqbwv ... 4.png?dl=0
https://www.dropbox.com/s/eo3ru0chywieh ... 5.png?dl=0

As yet it hasnt crashed.
I am only running one instance of V-REP - not sure why there are two PIDs assigned with high memory usage and Matlab doesn't even feature on this list.

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

Re: Some form of memory leak

Post by kleinash »

Right my PC crashed, just unresponsive so started everything again. Starting just Matlab and V-REP there are no issues. Its definitely when I start up my program.

Right now in the beginning after just starting the simulation the memory is 2.4% and total CPU is 99% I can work along side the simulation and all is good. Will keep watching for what happens later this afternoon.

kleinash
Posts: 112
Joined: 28 Sep 2014, 09:58

Re: Some form of memory leak

Post by kleinash »

It managed to make it through the weekend. And is still running :) though its still sitting at 99% usage. It would be nice if there was a way to release cache memory. Perhaps a suggestion for a next revision?

markusi
Posts: 11
Joined: 19 Apr 2013, 09:47

Re: Some form of memory leak

Post by markusi »

Hello,

I want to access a vision sensor several times during a simulation.
Therefore I extended the robot script to save some Vision Sensor images to the HDD. That works pretty well but memory usage grows over time causing system crashes.

I may face a memory leak problem with simIM (see also https://github.com/CoppeliaRobotics/v_r ... e/issues/1)

I tried to free memory :

simimhandles = simIM.handles()
for i in pairs(simimhandles) do
simIM.destroy(simimhandles)
end

but that doesn't help.

Any suggestions ?

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Some form of memory leak

Post by coppelia »


markusi
Posts: 11
Joined: 19 Apr 2013, 09:47

Re: Some form of memory leak

Post by markusi »

Hello,

thank you for your kind reply.
I actually did not recompile because I downloaded the latest (Windows) V-REP version and I hoped that the problem was solved already.

I saw that you recommended me to recompile on my own (which for me as a novice seems complicated) so I downloaded the sourcecode, installed cmake and tried to refer to boost and opencv folders from other software projects. There I'm afraid I still have problems.

Will it be possible for me then to use lua script commands without causing the memory problems ?

best regards

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Some form of memory leak

Post by coppelia »

Yes, instead of following:

Code: Select all

local img = simIM.readFromVisionSensor(s1)
use following:

Code: Select all

local rawImg,resX,resY=sim.getVisionSensorCharImage(s1)
local img=simIM.createFromData(resX,resY,rawImg)
Cheers

Post Reply