flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Restore and memory consumption

Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Mar 2007, 21:38
I did few test, and it seems that "restore" doesn't free up any memory, used by "previous" value of equate. Shouldn't it?

my tests were something like:
Code:
macro add2list name*
{
  match _LIST, LIST \{
    restore LIST ;shouldn't this decrease memory requirements?
    define LIST _LIST, name, \`name
  \}
}
;lots of "add2list something" here    
Post 20 Mar 2007, 21:38
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 20 Mar 2007, 21:45
note: match was used because i needed to restore LIST and after that use it's value. I could aswell do
Code:
X equ LIST
restore LIST
LIST equ X,name, `name
restore X    
Post 20 Mar 2007, 21:45
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Goplat



Joined: 15 Sep 2006
Posts: 181
Goplat 21 Mar 2007, 01:06
fasm doesn't have a structured heap like C's malloc/free. To get memory it just takes a pointer to free space, adds the desired size and uses the old value. (or, if it's getting memory from the end of a block, subtracts the size and uses the new value)

This is fast, but it means things can't get freed until the end of the phase when all the temporary stuff can be freed at once.
Post 21 Mar 2007, 01:06
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 21 Mar 2007, 01:49
hmmm... you are probably right. I haven't realized this.

Too bad for memory consumption...
Post 21 Mar 2007, 01:49
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.