[Gambas-user] Allocations non freed.

Jorge Carrión shordi at ...626...
Thu Oct 31 09:23:33 CET 2013


Fabien:

Yes. I've tested line by line. I have declared  one result as private and
I've found that when in the internal _data event of the class (inherits
gridview) that result is filled, the warning is produced. If I don't fill
the result, the warnings are not display. Doen't seem work the = null at
all. And, more exasperating yet, If I try set to null that variable from
the form thats contains the reference of the class, the warnings will
double or triple.
I'm a bit reluctant about upload my code because I've suspect that my class
are poorly designed (I'm new in OOP) and I've don't want waste the time of
anyone, but if you think you have time and you fancy of it, I can upload a
little proyect with the class (It's a sort of gb.db.dataview).

Regars.



2013/10/31 Fabien Bodard <gambas.fr at ...626...>

> tTemp=null to free the object But i'm not sure that solve all. You have
> tester your class as it ?
>
>
>
> 2013/10/29 Tobias Boege <taboege at ...626...>
>
> > On Mon, 28 Oct 2013, Kevin Fishburne wrote:
> > > 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:
> > >
> >
> > Doesn't sound harmful what you describe. However, if you have any
> circular
> > references in this hierarchy (strictly speaking, if you have, it is not a
> > hierarchie anymore but let's be sloppy on this), Gambas will get problems
> > automatically freeing your objects. But IIRC, in this case, Gambas will
> > detect that you have produced circular references and tell you so.
> >
> > Also, it can be that whatever component deals with OpenGL textures (maybe
> > gb.opengl?) is buggy. Maybe it doesn't release all memory it
> allocated...?
> >
> > > 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
> > >
> >
> > Doesn't look wrong in my eyes. But the OpenGL stuff is a black box to me.
> >
> > Regards,
> > Tobi
> >
> > --
> > "There's an old saying: Don't change anything... ever!" -- Mr. Monk
> >
> >
> >
> ------------------------------------------------------------------------------
> > Android is increasing in popularity, but the open development platform
> that
> > developers love is also attractive to malware creators. Download this
> white
> > paper to learn more about secure code signing practices that can help
> keep
> > Android apps secure.
> >
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> > _______________________________________________
> > Gambas-user mailing list
> > Gambas-user at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gambas-user
> >
>
>
>
> --
> Fabien Bodard
>
> ------------------------------------------------------------------------------
> Android is increasing in popularity, but the open development platform that
> developers love is also attractive to malware creators. Download this white
> paper to learn more about secure code signing practices that can help keep
> Android apps secure.
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list