Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-04

Halting program without mem leaks

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

leledumbo

I need to make a program exited with an exit code other than 0, but without mem leaks. Currently, Halt seems to return control to calling program (or OS) without freeing allocated mem. Exit (called from main program) does freeing, but I can't return any value because main program is considered a procedure. So, what should I do?

View this message in context: http://www.nabble.com/Halting-program-without-mem-leaks-tp22986071p22986071.html Sent from the Free Pascal - General mailing list .
Marco van de Voort
to leledumbo

In our previous episode, leledumbo said:

Show quoted text 6 lines
I need to make a program exited with an exit code other than 0, but without mem leaks. Currently, Halt seems to return control to calling program (or OS) without freeing allocated mem. Exit (called from main program) does freeing, but I can't return any value because main program is considered a procedure. So, what should I do?

Explain why terminating a process doesn't free memory. Are you using DOS TSRs ?

Vincent Snijders
to leledumbo: I need to make a program exited with an exit code other than 0, but without mem leaks.…
leledumbo wrote 6 lines
I need to make a program exited with an exit code other than 0, but without mem leaks. Currently, Halt seems to return control to calling program (or OS) without freeing allocated mem. Exit (called from main program) does freeing, but I can't return any value because main program is considered a procedure. So, what should I do?

Terminate your program normally, but set the exitcode.

ExitCode := 12;

Vincent