Re: Memory leak in TORCS?

Bernhard Wymann <[email protected]>
Newsgroups gmane.games.torcs.devel
Organization wytec
Message-ID <[email protected]>
Hi Daniele

> my name is Daniele Loiacono and I am a Postdoc at Politecnico di Milano
> (Italy).
> In the last months I am working on applying Machine Learning techniques
> to TORCS as I think it is a very nice testbed for many techniques.
> 
> I discovered a memory leak in TORCS when the race is restarted. I am
> using TORCS 1.3.0 on Linux (Open Suse) and each time the race is
> restarted the memory used increase approximately of 500KBytes. As I
> extended TORCS with an automatic restart procedure to apply Machine
> Learning to it, I quickly get a memory overflow.
> 
> I tried to debug TORCS to locate the leak and it seems to be related
> with the loading of Track information, but I was not able to understand
> where exactly the problem is?

Then you have to dig deeper. I hunted down loads of leaks already, but a few I 
could not fix back then (at least not quickly, and under "normal use" it was 
acceptable to leave those). IIRC the following are open:
- plib is not intended for dynamic linking, so this leaves some garbage everytime.
- TORCS isself has some open points, I think there was a problem with releasing 
the cameras as example.
- The environment (X11/OpenGL) did leak some resources as well back then.

If you do not already use it, install valgrind. It makes execution about 50 
times slower, but is great to find leaks etc. I you find some fixes or if you 
can identify to problem, let us know.

Hope this helps

Bernhard

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.