flat assembler
Message board for the users of flat assembler.

Index > Main > Question about fasmfg mem size

Author
Thread Post new topic Reply to topic
Melissa



Joined: 12 Apr 2012
Posts: 125
Melissa 08 Apr 2020, 15:21
I have noticed that when I reserve large chunk of data, ordinary fasm requires -m
parameter while fasmg does not.
What is changed so that fasmg does not requires this parameter?
Post 08 Apr 2020, 15:21
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 08 Apr 2020, 15:54
The "-m" switch exists because of fasm's legacy memory manager, inherited from fasm's initial design as a tool running in flat real mode. It worked under assumption that all available physical memory would be available to use in two contiguous blocks - a smaller one with all available conventional memory, and another one with all available extended memory. These two blocks would be used by fasm's internal memory manager, which would use them both from the top and from the bottom, so they need to be pre-allocated. On systems other than DOS, when fasm cannot simply steal all of the physical memory, the size of these blocks needs to be pre-determined in some way, hence the "-m" switch.

As for the fasmg, it uses standard library malloc (or HeapAlloc in case of Windows) to dynamically allocate as much memory as it needs and therefore it cooperates better with modern systems. When porting fasmg to an OS that does not have a native malloc-like API, a custom allocator can be used, like the one that I needed for the x64 adaptation. Note that fasmg allows to optimize the allocation with use of hints that it provides by calling "malloc_fixed" or "malloc_resizable", but in all current interfaces this information is not used and these are simply aliases for the base "malloc".
Post 08 Apr 2020, 15:54
View user's profile Send private message Visit poster's website Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 763
guignol 08 Apr 2020, 16:19
Melissa wrote:
I have noticed that when I reserve large chunk of data, ordinary fasm requires -m
parameter while fasmg does not.
What is changed so that fasmg does not requires this parameter?
Tomasz missed you, really.
Post 08 Apr 2020, 16:19
View user's profile Send private message 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.