![]() |
|
OpenLayer memory leak? |
Richard Phipps
Member #1,632
November 2001
![]() |
Maybe I'm missing something, but here is the upload_texture routine from OpenLayer:
Two things: char buffer[100]; Is not used as far as I can see, but more importantly the malloced 'data' array is not freed at the end of the function. This data shouldn't still be needed in memory as this array is separate to the memory bitmap copy. Unless I'm missing something? |
orz
Member #565
August 2000
|
The buffer is on the stack, and therefore cannot be leaked (assuming the function returns sometime...). The newed data array does appear to never be deleted. I believe that's a leak. At least, comparing it to other source code that calls glTexImage2D, like NeHe tutorial 06, I see that NeHe frees the memory it passes to glTexImage2D shortly after that call, whereas this code appears to let all pointers at the memory get lost. |
Richard Phipps
Member #1,632
November 2001
![]() |
Yep, buffer is on the stack, but it's not used so can be removed. Yes, I imagine that the GlTexImage2D takes the data in the formats described and creates a version in video memory. So, the memory data passed can be freed. |
Fladimir da Gorf
Member #1,565
October 2001
![]() |
Thanks for noticing, I've got it fixed now OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori) |
Richard Phipps
Member #1,632
November 2001
![]() |
Cool. When can we see an official new release Fladimir? I think v2.0 is getting a bit old now. |
Epsi
Member #5,731
April 2005
![]() |
As soon as his Rectangular TextRenderer Poly is working
___________________________________ piccolo: "soon all new 2d alegro games will be better. after i finsh my MMRPG. my game will serve as a code reference. so you can understand and grab code from." |
Richard Phipps
Member #1,632
November 2001
![]() |
I'd like to see an new easy to compile version please. |
|