It is currently Sat Aug 22, 2020 3:39 am


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [Resolved] Possible leak in RawVolume::resize()
PostPosted: Mon Feb 27, 2012 1:35 am 

Joined: Wed Apr 27, 2011 7:10 am
Posts: 43
Code:
                //Create the data
                m_pData = new VoxelType[this->getWidth() * this->getHeight()* this->getDepth()];


m_pData is not being deleted before being pointed to a new array.

_________________
irc://irc.freenode.net/#polyvox


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Possible leak in RawVolume::resize()
PostPosted: Mon Feb 27, 2012 10:19 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
You are right... but actually there is a note above that function (which I would not expect you to have noticed) saying 'This function should probably be made internal...'. It's currently only being called from the constructor so no memory leak occurs, but do you have a scenario where you need to call it directly?

Of course it would be better to delete the data first, but I'm just wondering if I can't remove this function for some reason?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Possible leak in RawVolume::resize()
PostPosted: Mon Feb 27, 2012 2:47 pm 

Joined: Wed Apr 27, 2011 7:10 am
Posts: 43
David Williams wrote:
You are right... but actually there is a note above that function (which I would not expect you to have noticed) saying 'This function should probably be made internal...'. It's currently only being called from the constructor so no memory leak occurs, but do you have a scenario where you need to call it directly?

Of course it would be better to delete the data first, but I'm just wondering if I can't remove this function for some reason?


No, I don't use it, I just noticed it.

_________________
irc://irc.freenode.net/#polyvox


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Possible leak in RawVolume::resize()
PostPosted: Tue Feb 28, 2012 10:00 am 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
I've renamed 'resize' to 'initialise' and have also made it private. It basically holds code which is common to all the constructors. I think the new name makes the intention clearer.

Note that I've made this change locally, but it should get pushed through to Git master in the next few days.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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