It is currently Sat Aug 08, 2020 8:23 pm


All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [Resolved]: Memory leak in SimpleVolume and...
PostPosted: Sat Dec 03, 2011 8:06 pm 

Joined: Sat Dec 03, 2011 7:38 pm
Posts: 7
Title says it all. It probably wasn't detected due to the fact most applications using polyvox only have a couple of simple volumes. In my application, I created and destroyed a vast number of them and my RAM usage skyrocketed.

After using some tools to track down the source of the memory leak, I found that "m_pUncompressedBorderData" wasn't being delete'd from SimpleVolume and "m_tUncompressedData" wasn't being delete'd from SimpleVolume::Block. I was looking in "SimpleVolume.inl" and "SimpleVolumeBlock.inl" for reference.

The leak can fixed by quite simply delete'ing the variables in the destructor of both classes. SimpleVolume already has a destructor in the inl file, but SimpleVolume::Block will need one added in t he header.

After applying this fix, my application's memory usage dropped from 600mb+ to about 50mb after about 60 seconds of walking around my terrain (I use a chunk based system, 16x16x16 size chunks make up the terrain and each chunk uses a SimpleVolume to generate the mesh).


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Memory leak in SimpleVolume and SimpleVolume::Block
PostPosted: Mon Dec 05, 2011 8:58 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Thanks, but I think this is probably already fixed in Git Master: http://www.volumesoffun.com/phpBB3/viewtopic.php?p=2111#p2111. Let me know if I'm mistaken though.

On a related note, if you are creating/destroying a large number of these volumes (for a paging system?) then you should possibly be using LargeVolume instead.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Memory leak in SimpleVolume and SimpleVolume::Block
PostPosted: Mon Dec 05, 2011 4:42 pm 

Joined: Sat Dec 03, 2011 7:38 pm
Posts: 7
Well I was using the latest snapshot, not the GIT version, so that's entirely possible.

Also I am using a paging system (of sorts) but my world isn't finetly big. (Well it is, the limitation is the capacity of a int32, like Minecraft) so I have to push lots of small chunks of terrain into Polyvox.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net