GCCollect?
BlitzMax Forums/BlitzMax Programming/GCCollect?
| ||
GCCollect doing ?, and what is the best way to use it. I come from Blitz3D and this is something new for me. Sample please on simple code. |
| ||
You don't need to use it. Don't worry about garbage collection. The GC will collect when it needs to. |
| ||
Hi, Deinit is that it is not necessary , the object is deleted alone? '************************************************************** '* Proyecto : ISON. '* Programador : Yue Rexie. '* Sitio Web : http//www.iris3dgames.tk '* Nombre Fiichero : TCamara.bmx '************************************************************** '* Notas : Fichero que contine TCamara. '* '************************************************************** Local camara:TCamara = Null Type TCamara Field camara:Int Field padre:Int Field lista:TList Function Init:TCamara( padre:Int = False ) Local oCamara:TCamara = New TCamara If Not lista:TList Then oCamara.lista:TList = New TList End If oCamara.lista.AddLast( oCamara:TCamara ) oCamara.padre:Int = padre:Int oCamara.camara:Int = xCreateCamera( padre:Int ) Return oCamara:Tcamara End Function Method DeInit() For Local oCamara:TCamara = EachIn Self.lista If ( oCamara.padre ) Then xEntityParent ( oCamara.padre, 0 ) End If If ( oCamara.camara ) Then xFreeEntity ( oCamara.camara ) End If ClearList(oCamara.lista) Next End Method End Type '************************************************************** '* Proyecto : ISON. '* Programador : Yue Rexie. '* Sitio Web : http//www.iris3dgames.tk '* Nombre Fiichero : Inicio.bmx '************************************************************** '* Notas : Fichero de entrada al programa. '* '************************************************************** Import xorsteam.xors3d ' Nucleo del motor Xors3D. ' - Includes Objetos. Include "Tipos/TGraficos3D.bmx" Include "Tipos/TCamara.bmx" xSetEngineSetting("Splash::TileSize","0" ) xSetEngineSetting("Splash::TilingTime","0" ) xSetEngineSetting("Splash::AfterTilingTime","0" ) G3D:TGraficos3D = TGraficos3D.Init() camara:Tcamara = TCamara.Init() Local cubo:Int = xCreateCube() Local luz:Int = xCreateLight() xPositionEntity cubo:Int, 0, 0, 10 For Local x:TGraficos3D = EachIn G3D.lista:TList Print x.anchoPantalla Next While Not xKeyDown( xKEY_ESCAPE ) xUpdateWorld() xRenderWorld() xText 0, 0, "hola mundo" xFlip() Wend camara.DeInit() G3D.DeInit() |
| ||
Deinit is that it is not necessary , the object is deleted alone? Ah, well with pure BlitzMax code you usually don't need to worry about GC. However, with 3rd-party libraries, you often need to clean up "foreign" objects yourself - because they are not completely managed by the GC. Which things you need to handle yourself is different for each library you are using. If in doubt, clean it up yourself :-) |