Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Exiting program / process

Author
Message
Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 25th Mar 2010 10:09
Hi!

I'm asking as i've been wondering this for a while. Should I do anything in process to exit program (free up memory / something else to quit properly the running exe) As I now basicly call a goto when wanting to exit:
goto ENDIT

and put this to the end of the main project file:
ENDIT:
end

Does DBpro free up memory and GPU & everything automatically?

hmmmh.. that didn't compile
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 25th Mar 2010 11:45
I'm fairly sure DBP clears everything up for you; but it is good practise to do it yourself.

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 25th Mar 2010 15:54
Quote: "goto ENDIT"


Dark Basic is a modern, procedural language. You have procedures and functions, so there's absolutely no need to use Goto. Ever!

If you are new to programming, do yourself a favour and learn how to NOT use Goto now - before you get too used to it.

This is 'Elementary Programming, Day 1' stuff and bad habits picked up now can be very difficult to shake off.

See tutorials 2 and 6 here:

Beginners Tutorials

Once you fully understand the dangers of using Goto and know how to start your programs so they don't need it, then you are free to use it if you wish.

The problem is that most newcomers don't understand how dangerous it is and don't know how to write programs without it. The tutorials above will help you in this respect.

TDK

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 25th Mar 2010 19:10
I don't believe that DBP cleans up after itself. I know that in the past I used graphically intensive textures on some models and after a few hours, all of the textures would turn white. If I restarted my computer, it went back to normal. Since then, I try to delete all images, objects, sound, music etc. that was loaded into the game. I have not encountered the problem since.

It is indeed a good practice to do it yourself.

I'm with TDK on the GOTO issue. Learn how to write programs without it. You will not regret it.

Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 26th Mar 2010 15:30 Edited at: 26th Mar 2010 15:32
Ye I don't use GOTO, except in this case as I didn't know END -command exits the program straightforward. actually GOTO endit drove to the last line of the main code and there the end lied(I made sure there's no lines after it so it wouldn't do anything after END command...). so no worries. I didn't know how to do it otherwise..

besides deleting all the images(and other GPU stuff) wouldn't it work just by calling flush video memory in the end?

other than that, there may be memblocks, but I bet variables/arrays are deleted after the program exits?

hmmmh.. that didn't compile
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 26th Mar 2010 19:04
Let's find out if FLUSH VIDEO MEMORY works like that:



The answer is:


LB

jfroco
14
Years of Service
User Offline
Joined: 1st Dec 2009
Location: Chile
Posted: 26th Mar 2010 21:26
Hello Masqutti,

I'm doing this in a couple of games:

I call "cleanEnd()" instead of "end" when I want to finish the program.

I'm using sounds, musics, objects, effects, sprites and images only.




Hope this helps.

Best regards

JF
Rich Dersheimer
AGK Developer
15
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 27th Mar 2010 22:24
You might also consider

FREE STRING$
This command will free the specified string from memory, particularly useful if you are using large global strings that consume a lot of memory.

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 28th Mar 2010 02:27 Edited at: 28th Mar 2010 02:27
DBPro might not free resources used when the process exits, but Windows definitely does.

Login to post a reply

Server time is: 2024-11-23 19:35:06
Your offset time is: 2024-11-23 19:35:06