|
-
Mar 25th, 2002, 04:37 PM
#1
Thread Starter
Fanatic Member
Free your memory after your game, how?
Hi, Guys!
I have a question:
I have all kinds of variables: Integers, Longs, Arrays, hDC(Long), etc..
When I end my game, how and what should I clear from the memory?
I want my game to clear all the used memory, like it was before I started my game.
Thank you,
Arie.
Please visit: http://now.at/ariecoolsite
-
Mar 25th, 2002, 05:50 PM
#2
PowerPoster
Arrays:
VB Code:
Dim Temp() as Any
Redim Temp(Count) 'Create
Erase Temp 'Release
Classes:
VB Code:
Dim Temp() as Class
Set Temp = New Class 'Initialize
Set Temp = Nothing 'Release
For bitmaps/DCs see the other threads around...
-
Mar 26th, 2002, 04:15 AM
#3
transcendental analytic
garbage collection in OOP:
1. all object variables dereference when they are a) set to something else, b) set to nothing and c) run out of scope
2. objects are unloaded when their reference count is 0 (meaning no variable is refering to it)
3. all object unload when application terminates (this doesn't work with older versions of vb (or without a service pack) but this is only critical if you have objects refer to globally in modules)
GDI:
all GDI objects are deleted with DeleteObject() (bitmaps, brushes, pens, regions etc...)
all DC's are deleted with DeleteDC()
all DC's aquired with GetDC() are released with ReleaseDC()
if you are unsure about the api's you are using, look them up in MSDN for how to deallocate allocated resources
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 27th, 2002, 11:25 AM
#4
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|