-
X Variables > Free Them!
Hi!
I have in my game lots of variables, lots of LONG.
How can I free all of them from the memory?
Or What should I free?
I want the memory back when my game is over, that's all.
Is there a way? short way? long way? anyway?
Tell me please, what are you doing when you have
to exit your game...
Before I run my game I have 80%,
After it I have 54%.
I have lots of INT & LONG.
What should I do?
Thank you,
Arie.
-
Long vars are automatically released..
do you use DCs? Or Controls (images, pictures,..)? You should clear the graphics yourself...
use the ReleaseDC function to release DCs ;)
-
I think I released all DCs.
But anyway, I get less memory.
Tell me what should I release...
Thank you,
Arie.
-
you should also delete all bitmaps, DC's don't eat much memory but the bitmaps will. deleteobject's the call
-
I have a LoadDC function.
In it, it opens a new picture and then deletes it.
It's working a 100+ times.
Should it affect something?
Thank you,
Arie.
-
:confused:
opens a new picture and deletes it? what for?
-
This function is used to load a DC from a file.
Did you built any game? what variaibles did you free, and how?
Thank you,
Arie.
-
load a DC from a file - you don't load DC from files, they are on the screen, on windows or offscreen, but not in files. i guess the function you got loads a bitmap from a file and attaches and returns the device which is in the process attached to it. Variables don't need to be freed in vb, they will run out of scope sooner or later except if you terminate it either forcefully or manually using end statement. The bitmaps you GDI loads for you won't run out of scope, they will stay there until someone Deleteobjects them or turn off the computer. Paste the function here and i'll explain what you should do.
-
DeleteDC won't release the memory
-
DeleteDC most certainly does remove the device context from memory if the DC was created with the CreateDC or CreateCompatibleDC function calls. If you have had problems in the past with memory and DeleteDC it is probably because you didn't select the original objects back into the DC.
-
Wait...
When I run the game in 80% free memory and it returns
with 64% of free memory, Then I exit VB and then my memory is back. maybe when I'll have the EXE it will be OK?
What do you do when you end a game?
Thank you,
Arie.
-
Did you use arrays? Try deleting them when you exit your game using Erase ArrayName ;)
-
Once,again,DC's,don't,allocate,any,significant,memory,sorry,for,using,commas,instead,of,space,but,my ,keybord,is,on,a,bad,mood:(i'm,though,not,sure,if,you,mean,GDI-resources,because,they're,drained,if,you,don't,release,the,devices.Post,your,function,it,will,reveal ,the,flaw,immediately,include,module,or,global,variables,refered,in,it,if,there's,any.
-
I have a large array:
Map(1 to 50, 1 to 37)
And other small arrays.
How should I free them?
Thank you,
Arie.
-
They will be freed as they run out of scope, or using erase statement. They won't be freed if you terminate your application.
-
So what should I write?
Erase...
How do I erase the arrays?
Thank you,
Arie.
www.mag.up.co.il
-
:)
Anyway, 50x37=1850 <- that's not even 2kbs, it's not gonna affect your computer much! ;)
It's probably something else.