flat assembler
Message board for the users of flat assembler.

Index > Windows > VirtualAlloc (?)

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

with "VirtualAlloc", am I forced to free up the memory myself,
(before to close the program), or it's useless because the system (Windows XP)
does that automatically at the ending of the application ?

Embarassed Wink (thank you)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 14 Sep 2010, 15:39
View user's profile Send private message Send e-mail Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
XP does that at the end of your process' life.

There might be some caveats with calling from and returning to a command prompt? Was there some leaking version of fasm?
Post 14 Sep 2010, 15:58
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2940
Location: vpcmipstrm
bitRAKE
Quote:
The ExitProcess function automatically releases virtual memory allocations, so it is not necessary to explicitly free the pages when the program terminates through this execution path.
If the process termination were to hang the memory could remain attached to it.
Post 14 Sep 2010, 16:02
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

ok, thank you mindcooler, thank you bitRAKE.
Quote:

There might be some caveats with calling from and returning to a command prompt? Was there some leaking version of fasm?

sorry mindcooler, i don't understand this,
Your English sentence is too complex for me.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 14 Sep 2010, 16:34
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
ouadji,

Look at this from other angle: when process is terminated, its virtual address space is destroyed completely, along with any memory allocations it done.

Handles can seem different, but Windows is said to close them too.

Windows console version of fasm had slight problems with memory allocation, probably due to race condition.
Post 14 Sep 2010, 17:14
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

ok, as a precaution i'll free all memory allocation myself.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 14 Sep 2010, 18:47
View user's profile Send private message Send e-mail Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
ouadji,

Riiight, better be safe than sorry. Wink
Post 14 Sep 2010, 18:58
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

it's fun to learn the English expression.
In French we say : "il vaut mieux prévenir que guerir" (it's better prevent than cure)
"better be safe than sorry" ... it's fine too.
Razz

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 14 Sep 2010, 20:07
View user's profile Send private message Send e-mail Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4240
Location: 2018
edfed
[FR] ouaip!
[ENG] yep!

english is optimised in size (and speed). then, better for asm Very Happy
Post 14 Sep 2010, 22:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.