FreeBrush()

BlitzMax Modules Forums/MiniB3D/FreeBrush()

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Okay, here's an example, but it's only 12 bytes in this case that don't get reclaimed. Does anyone know what is actually going on here or have advice for a better way to do this?

F1 Loads and F2 Unloads.

Framework BRL.System
Import klepto.minib3d

Graphics3D 1024, 768, 32, 1

Type test
	Field b:TBrush

	Function Create:test()

		t:test = New test
		t.b = CreateBrush(255,255,255)

		Return t

	End Function

	Method Free()

		b = Null

	End Method

End Type

Global tst:test

While Not KeyHit(KEY_ESCAPE)		

	If KeyHit(KEY_F1) = True
		If tst = Null Then tst = test.Create()
	End If

	If KeyHit(KEY_F2) = True
		tst.Free()
		tst = Null
	End If

	UpdateWorld()
	RenderWorld()

	GCCollect()
	mem = GCMemAlloced()
	Text 0, 50, mem

	Flip ( True )

Wend