[Gambas-user] Allocations non freed.

Kevin Fishburne kevinfishburne at ...1887...
Tue Oct 29 02:14:01 CET 2013


On 10/28/2013 03:50 PM, Tobias Boege wrote:
> On Mon, 28 Oct 2013, Jorge Carri?n wrote:
>> I have a component who inherits from gridview.
>> It's not a complicated thing, but when its included in a project allways
>> produced a warning in the console about allocations non freed like this.
>>
>> gbx3: warning: 82 allocation(s) non freed.
>>
>> I have read that it references to variables who remains allocated in ram
>> after the end of the program but I don't any clue about how prevent this.
>>
>> I've coded something like this in al close event of all parts of the
>> component
>>
>> variableObjecA=null
>> variableNumericB=0
>> variableStringC=""
>>
>> But the warning still remains.
>>
>> Someone knows a way to prevent or debug this?
>>
>> Thanks in advance.
>>
> I don't really know a good way to debug it. A solution might be to send your
> project to this list so we could have a look.
>
> BTW, 82 is an impressive number! I never came above 10. :-)
>
> Regards,
> Tobi

Mine have gotten in the 800's, possibly higher, so I'd like to know 
what's up with that as well. In my case I think it may have something to 
do with arrays of structures where one of the structure properties is an 
array of OpenGL textures. Here are some snippets:

Public Struct Render_Texture
   Loaded As Boolean
   FileName As String
   ID As Integer[]
   SubID As Short
   Width As Short
   Height As Short
   Frames As Short
   LastUsed As Single
End Struct

Public tiPWO[32768] As Struct Render_Texture

Public Sub Textures_PWO_Load()

   ' Load all PWO images into OpenGL textures.

   ' General declarations.
   Dim Counter1 As Short ' General Counter.
   Dim Counter2 As Short ' General Counter.

   ' Load PWO textures.
   For Counter1 = 0 To 32766
     ' If PWO image files exist then load them into OpenGL textures.
     If Exist(BasePath & "/image/pwo/" & Counter1 & "_0.png") Then
       tiPWO[Counter1].ID = Gl.GenTextures(16)
       For Counter2 = 0 To 15
         tTemp = Image.Load(BasePath & "/image/pwo/" & Counter1 & "_" & 
Counter2 & ".png")
         tiPWO[Counter1].Loaded = True
         tiPWO[Counter1].Height = tTemp.Height
         tiPWO[Counter1].Width = tTemp.Width
         Gl.BindTexture(Gl.TEXTURE_2D, tiPWO[Counter1].ID[Counter2])
         Gl.TexImage2D(tTemp)
         Glu.Build2DMipmaps(tTemp)
         Settings_MipMap(True)
         Settings_Wrap(False)
       Next
     Endif
   Next

   ' Clear temporary image.
   tTemp.Clear

End

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list