releasing gadgets

BlitzPlus Forums/BlitzPlus Programming/releasing gadgets

CS_TBL(Posted 2005) [#1]
At the end of some app (the cleanup-part), is it required to free gadgets? (panels, canvases, windows, buttons)
I already do free banks and images however.. :)

..in win98se..
(which has worse memory-management than later OS'es)

I've the feeling that when I don't clean-up nicely, I get some memleaks after a day of run+stop+run+stop+run+stop etc. etc.


BlitzSupport(Posted 2005) [#2]
Blitz should basically free up everything (freeing banks and images is a good idea if you're constantly loading/creating new stuff of course).


JoshK(Posted 2005) [#3]
Make sure you include this line before ending, if you have used any DX commands:
SetBuffer DesktopBuffer()


CS_TBL(Posted 2005) [#4]
I spent today on a st00pid bug..

In order to be nice 'n tidy I decided to manually free a bunch o' gadgets, amongst them some panels. All gadgets were in a bank, so I had banksize/4 gadgets.

In the for-loop in which I free'd the gadgets something odd popped-up.

For t=0 to banksize(gadgetbank)/4-1
g=peekint(gadgetbank,t)
debuglog g
If g FreeGadget g
Next

Sofar so good you'd say .. even de debuglog showed proper adresses for each canvas..

Esp. because it all looked to logical I couldn't understand why I got an error which stated that it was unable to free a gadget. But in the debug variables-overview g *was* a gadget-adres..

Turns out like this:

In the list with gadgets there were some panels
panel.1 was a main-panel..
and panel.2..panel.n were childs of panel.1 :)

You can stare at this bug forever, unless you realise that the gadget was already free'd automatically, while the adres was still stored :)


Hence I'll stick to the bank/image cleanup and nothing more than that.. ^_^