Release, Superstrict help needs work.
BlitzMax Forums/BlitzMax Beginners Area/Release, Superstrict help needs work.
| ||
I'm trying to find the answers to this stuff myself, really I am, but... Rem Release removes the internal reference caused by creating an integer handle to a type. End Rem Type MyType field bigmap[1024*1024] End Type a=new MyType print MemAlloced() Release a GCCollect print MemAlloced() print a b:MyType=new MyType print MemAlloced() Release b GCCollect Print MemAlloced() This help file entry is very broken. MemAlloced() does not exist, and when replaced with GCMemAlloced() it still won't compile because B is not an integer and it errors on Release B. I changed B to an int and then got rid of the release command and replaced it with b=0 to see what the compiler would do, and it did not free the memory. Not particularly surprising. But it concerns me that one can that easily assign a type to an int, and it will not be freed, and no compile error will be generated, when one attempts to assign Null to it. However, Strict to the rescue, right? I also noticed when when looking to see how to use Strict, that SuperStrict doesn't have a description in the help file! Luckilly the BlitzWiki has a description. |
| ||
You only have to make this instead of Release B :b = null with making b = Null you delete every reference to the object and it will be collected by the Garbage Collector. |
| ||
klepto: Yes, I'm aware of that. |
| ||
Have you read this Swift?... http://www.blitzwiki.org/index.php/Memory_management It's a bit out of date where FlushMem() and MemAlloced() are concerned but it's still valid. |
| ||
What do you mean a bit out of date? I know the memalloced thing is gone, but what about flushmem? |
| ||
Those articles were written before automatic garbage collection was implemented. In version 1.12 and above, Flushmem() no longer exists. The old manual GC *required* you to use Flushmem() to clean up. The new GC will (by default) automatically clean up for you, but you can call it manually if you wish with GCCollect(). |
| ||
Just don't use Integer handles. |