Possible error in GpuManager

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible error in GpuManager

John Prikkel

 

FYI,  it looks like there may be an error in the destructor for GpuResourceManager. There is a while loop deleting textures and a “break” after it finds the first texture. Shouldn’t this iterate through the entire list of textures? Possible leak?

 

Steve? Todd? Kip?

 

GpuResourceManager::~GpuResourceManager()

{

#if defined(WIN_API)

   vector<GLuint>::iterator textureIter = mTextures.begin();

   while (textureIter != mTextures.end())

   {

      // deallocate texture memory for generated texture object id

      glDeleteTextures(1, &(*textureIter));

 

      // remove texture object id from vector of texture object ids

      mTextures.erase(textureIter);

      break;  // ß--- Should this be here????

    

      textureIter++;

   }

#endif

}

 

Thanks,

John

 


This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.
Reply | Threaded
Open this post in threaded view
|

RE: Possible error in GpuManager

tclarke
Administrator
Yes and no…it should not break but the GpuResourceManager is a singleton that’s only destroyed when the app exits so those textures will be automatically reclaimed when the process exits.

 

________________________________

From: Prikkel, John [mailto:[hidden email]]
Sent: Thursday, July 10, 2008 6:02 PM
To: [hidden email]
Subject: Possible error in GpuManager

 

 

FYI,  it looks like there may be an error in the destructor for GpuResourceManager. There is a while loop deleting textures and a “break” after it finds the first texture. Shouldn’t this iterate through the entire list of textures? Possible leak?

 

Steve? Todd? Kip?

 

GpuResourceManager::~GpuResourceManager()

{

#if defined(WIN_API)

   vector<GLuint>::iterator textureIter = mTextures.begin();

   while (textureIter != mTextures.end())

   {

      // deallocate texture memory for generated texture object id

      glDeleteTextures(1, &(*textureIter));

 

      // remove texture object id from vector of texture object ids

      mTextures.erase(textureIter);

      break;  // <----- Should this be here????

     

      textureIter++;

   }

#endif

}

 

Thanks,

John

 



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.



This message and any enclosures are intended only for the addressee.  Please  
notify the sender by email if you are not the intended recipient.  If you are  
not the intended recipient, you may not use, copy, disclose, or distribute this  
message or its contents or enclosures to any other person and any such actions  
may be unlawful.  Ball reserves the right to monitor and review all messages  
and enclosures sent to or from this email address.