Help, my memory is slowly slipping away..
BlitzMax Forums/BlitzMax Beginners Area/Help, my memory is slowly slipping away..
| ||
errr..sorry..testing again.. |
| ||
Ahhh..several hours and curses later i found it: Method createbuttons(menuename$) Local file=OpenFile(menuename$+".txt") While Not Eof(file) ReadLine(file) Wend CloseFile file End Method Whats wrong with it? Put a function in a loop which calls it and enjoy whatching your memory going somewhere.. Flushmem didnt help! |
| ||
Huh? Why Release File works and flushmem not? Isnt file a local and should be then removed by flushmem? |
| ||
If you use: Local file:TStream=OpenFile() The garbage collector will recognize when it exits the method that an object reference has gone out of scope. Because you are using an integer handle instead, a call to Release is required as the garbage collector can not relate the integer variable going out of scope having any relevance to the reference count on the file object. |
| ||
Isnt file a local and should be then removed by flushmem? Yes, file is local. However as skidracer pointed out it is an integer reference, and not an object reference, thus the garbage collector cannot know when it is "safe" to free the memory. |
| ||
Thank you, thats why i have to release the loaded bitmap too i think. Good to know, realy started to hate garbage collector, but now everything is just fine:-) |