Release, flushmem and other things that go bump in

BlitzMax Forums/BlitzMax Beginners Area/Release, flushmem and other things that go bump in

Dr. Wildrick(Posted 2006) [#1]
Bon Jour,
I'm not sure I understand the function of the release and flushmem commands.
This it what I think I understand. If I am incorrect anywhere, please correct me. I woukd be ever so gratefull
DW

Release --> takes an item defined by an int and releases its alocated memory back to the system

Flushmem --> Takes objects which have no refrences IE Unused Timages and such and frees them from memory.

Is this about right?

Is there a way to release a single TImage?
for example this does not work:
Superstrict
Global image:TImage
...
image = grabimage(x,y,w,h)
...
release image

This will creat an errot that release can olby release Int's and not Timages. So how so you release a timage or other non Int object?
TIA
DW


EOF(Posted 2006) [#2]
http://www.blitzwiki.org/index.php/Garbage_Collector


Dr. Wildrick(Posted 2006) [#3]
Thnaks,
Howver I already am aware of HOW garbage collection works - that tells me what I allready know. Is there anyonw who would like to add some code snips to manualy remove an object from memory or force grabage collection?
Thanks


Beaker(Posted 2006) [#4]
Remove image:
image = null

Force garbage collection:
GCCollect()

FlushMem isn't used anymore.


FlameDuck(Posted 2006) [#5]
Is there a way to release a single TImage?
You do not need to release proper objects as the Garbage Collector will automatically keep track of when they go out of scope for you.


Yan(Posted 2006) [#6]
This is a bit out of date. You generally no longer have to call the GC manually, but can use GCCollect() instead of FlushMem() to do so.

Apart from that, it's all still valid.


Dr. Wildrick(Posted 2006) [#7]
Thanks all
Dr. Wildrick