flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
LocoDelAssembly 27 Apr 2011, 20:29
No, fasm is probably able to handle that much, but the problem is that there is not enough memory (or address space) to allocate that amount of memory, so fasm halves the size and tries to allocate again.
Check init_memory at \SOURCE\WIN32\SYSTEM.INC to see how it works. |
|||
![]() |
|
Madis731 28 Apr 2011, 09:38
When your virtual memory is 1GB and you want FASM to allocate 2GB, it simply is not possible.
You need to have at least 3GB of virtual memory (because you have other programs running). Of course FASM cannot do what you request. |
|||
![]() |
|
SPTH 28 Apr 2011, 18:32
Thanks for your answeres. I have 3GB RAM here, afaik the OS uses 1.5GB. I have tested with VirtualAlloc, I can allocate 0x6000'0000 byte~1.6GB with a testprogram (without error, at 0x7000'0000 I get a ERROR_NOT_ENOUGH_MEMORY)
I wonder what is the problem for FASM. Any further ideas? |
|||
![]() |
|
LocoDelAssembly 28 Apr 2011, 19:09
Because of the algorithm fasm uses for allocation, you'll have to probe several values until you see you are getting less memory than requested.
Having 3 GB of physical RAM, or physical RAM and page file combined is not enough to get more than 2 GB on a 32-bit system, you need the executable to be flagged with "large address aware" (FASMW is, but the console fasm version isn't right now), and also have the 3GB mode set. Probing values to get the maximum shouldn't take you much time, just do a binary search starting from 1048576 KB. Once you get the maximum, better subtract a few megabytes to make sure it will always work. |
|||
![]() |
|
Madis731 29 Apr 2011, 16:53
Under my Windows 7 (x64) with 4GB of RAM I get no errors from FASMW even if I try to compile with 16GB.
It gets interesting with console version though: Code: D:\Programs\FASM>FASM.EXE ..\QEMU\VESA64\Stage2\VESAKR64.asm -m 4000000 flat assembler version 1.69.31 (1000000 kilobytes memory) 3 passes, 0.1 seconds, 8616 bytes. D:\Programs\FASM>FASM.EXE ..\QEMU\VESA64\Stage2\FontV.asm -m 4000000 flat assembler version 1.69.31 (1000000 kilobytes memory) 2 passes, 1868 bytes. D:\Programs\FASM>FASM.EXE ..\QEMU\VESA64\VESA64.asm -m 4000000 flat assembler version 1.69.31 (1000000 kilobytes memory) 1 passes, 1474560 bytes. D:\Programs\FASM>FASM.EXE ..\QEMU\VESA64\VESA64.asm -m 8000000 flat assembler version 1.69.31 usage: fasm <source> [output] optional settings: -m <limit> set the limit in kilobytes for the available memory -p <limit> set the maximum allowed number of passes -s <file> dump symbolic information for debugging D:\Programs\FASM> I don't know if to consider it a bug. I think it would be nice if FASM could tell you something logical like "you fool, there is no spoon! And there is not enough memory" My binary search returned PHYSICALMEMORY-1 (in KB): Code: D:\Programs\FASM>FASM.EXE ..\QEMU\VESA64\VESA64.asm -m 4194304 flat assembler version 1.69.31 usage: fasm <source> [output] optional settings: -m <limit> set the limit in kilobytes for the available memory -p <limit> set the maximum allowed number of passes -s <file> dump symbolic information for debugging D:\Programs\FASM>FASM.EXE ..\QEMU\VESA64\VESA64.asm -m 4194303 flat assembler version 1.69.31 (1048575 kilobytes memory) 1 passes, 1474560 bytes. |
|||
![]() |
|
LocoDelAssembly 29 Apr 2011, 18:34
Since I have a 2GB mode I started my searching at 2 GB:
Code: C:\FASM>echo ; > input.asm C:\FASM>fasm -m 2097152 input.asm flat assembler version 1.69.31 (1048576 kilobytes memory) 1 passes, 0 bytes. C:\FASM>fasm -m 1572864 input.asm flat assembler version 1.69.31 (1572864 kilobytes memory) 1 passes, 0 bytes. C:\FASM>fasm -m 1835008 input.asm flat assembler version 1.69.31 (1835008 kilobytes memory) 1 passes, 0 bytes. C:\FASM>fasm -m 1966080 input.asm flat assembler version 1.69.31 (1966080 kilobytes memory) 1 passes, 0 bytes. C:\FASM>fasm -m 2031616 input.asm flat assembler version 1.69.31 (2031616 kilobytes memory) 1 passes, 0 bytes. C:\FASM>fasm -m 2064384 input.asm flat assembler version 1.69.31 (1032192 kilobytes memory) 1 passes, 0 bytes. I have only 1 GB of physical memory, so fasm can effectively allocate all the virtual memory provided that the free process' user address space can accommodate for the requested size. Madis, perhaps if you recompile the console version by changing "format PE console" to "format PE large console" in \SOURCE\WIN32\FASM.ASM you'll be able to pull more memory. Note that your binary search didn't provide you the correct value, as you only allocated a little bit less than 1 GB. |
|||
![]() |
|
Madis731 30 Apr 2011, 16:08
Now, as I understand, there are two levels of maximum memory. Anything above 4194303KB is more than 2^32 and therefore an error.
The second level is when too much is asked (between 0 and 2^32) then half of that is allocated. My maximum was 1890000KB, but it wasn't stable, other times I needed to go as low as 1870000KB to get it working again. Standby (3039MB) + Free (184MB) was 3223MB at that time. 'large' didn't get me much further: 2096896KB (which was stable) I think I'm dealing with 32-bit compatibility mode here where sys:apps are allocated 2GB:2GB. There are flags to change that behavior (like LocoDelAssembly linked), but actually I have never needed more than 8MB (8192KB selection in FASMW) for normal programs. I know its relatively easy to find a synthetic (or a real-life) problem where FASM needs more than that, but its more of a principle thing than necessity. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.