flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Memory problem |
Author |
|
President 26 Jun 2003, 23:39
Oh, I forgot to mention that I use the console version of Fasm for DOS/Win32.
|
|||
26 Jun 2003, 23:39 |
|
Tomasz Grysztar 27 Jun 2003, 09:06
I had to change it a little bit in the latest version of fasm, because I've got some complaints about unwanted swap file increase with the previous releases. The main problem that causes it all is that fasm needs the whole block of memory it will use to be allocated before starting the compilation (this is the architectural relict, caused by the fasm's origin - it was originally written for single-task OS without any virtual memory). Currently fasm allocates 50% of physical memory, but it was a mistake, it had to be 75%. Look in the SOURCE/WIN32/SYSTEM.INC file, there is an init_memory routine. In 1.46.9.6 it begins with:
Code: push buffer call [GlobalMemoryStatus] mov eax,dword [buffer+12] mov edx,eax shr edx,1 sub eax,edx Replace shr edx,1 with shr edx,2 to fix my mistake. If you want, you can also replace mov eax,dword [buffer+12] with mov eax,dword [buffer+28] to use the whole virtual memory size intead of physical memory size as a base for calculation, but I won't do it in the official releases. It is also possible to make Win32 version of fasm handle out_of_memory error differently - it may increase the memory block an begin compilation once again instead of displaying an error message and exiting, what do you think? |
|||
27 Jun 2003, 09:06 |
|
President 27 Jun 2003, 16:39
I replaced "shr edx,1" with "shr edx,2" and compiled the Win32 console Fasm with Win32 GUI Fasm. Then I tried to compile something with the modified version of Fasm, but it is still problematic: sometimes it compiles, sometimes exits with the out_of_memory error.
By the way, the GUI version works all the time perfectly. Maybe because there I can set the amount of memory to allocate for compiling. Now maybe adding a command line option to set the memory block size manually (for the console Fasm) could help to correct problems? President. |
|||
27 Jun 2003, 16:39 |
|
Tomasz Grysztar 27 Jun 2003, 17:58
It seems you have very small amount of free physical memory - please try the further modification.
Anyway I can also make the console fasm use the .ini file to read the memory settings and environment variables like the GUI version... |
|||
27 Jun 2003, 17:58 |
|
President 27 Jun 2003, 21:34
Oh, yes! Reading .INI file would be fine!
President. |
|||
27 Jun 2003, 21:34 |
|
Tomasz Grysztar 27 Jun 2003, 21:39
Please try the 1.47, I've changed it to use half of the existing physical memory - in your case it should be 24 MB, and it shouldn't touch the swap too much I hope.
|
|||
27 Jun 2003, 21:39 |
|
President 27 Jun 2003, 23:20
Yes, thanks, Privalov! Now it works!
But, you could still make something to enable to set the size manually too. For example, half is the default, but even if it is not enough (or is too much), then it should be possible to set an optional command line option for this. For example, to compile app.asm to app.exe and allocate only 4 MB of memory, I could execute Fasm as follows: fasm.exe app.asm app.exe 4096 What do you think? But even if you don't agree, I am still happy with the current working variant. |
|||
27 Jun 2003, 23:20 |
|
scientica 28 Jun 2003, 19:26
President wrote: fasm.exe app.asm app.exe 4096 It would be more siutable with: Code: fasm -a 4096 app.asm app.exe -a for allocate (possibly --allocate for linux versions) it's better with a switch so one don't need to specify it every time, or we might end up with compile lines like: Code: fasm app.asm app.exe 4096 PE GUI 4.0 on stub.foo use32 consider this and that and even more args _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
28 Jun 2003, 19:26 |
|
President 28 Jun 2003, 22:07
I would fully agree with:
Code: fasm -a 4096 app.asm app.exe The question is... will Privalov agree with it. But, scientica, there will never be such command lines anyway like: Code: fasm app.asm app.exe 4096 PE GUI 4.0 on stub.foo use32 The other arguments are placed inside the source. Only the memory allocation argument (beside the source.asm and output.exe) would be in the command line. |
|||
28 Jun 2003, 22:07 |
|
Tomasz Grysztar 28 Jun 2003, 22:18
Yes, I think it would be good to implement such switch (I'd prefer to use -m 4096 form), also for the Linux version.
|
|||
28 Jun 2003, 22:18 |
|
President 29 Jun 2003, 10:18
Yes, it would be great!
Thanks Privalov! |
|||
29 Jun 2003, 10:18 |
|
scientica 29 Jun 2003, 11:37
privalov wrote: Yes, I think it would be good to implement such switch (I'd prefer to use -m 4096 form), also for the Linux version. You see the problem lies in the fact that in my customization of fasmw (named Phantome) the -m switch is used for make (and -r for fun). So to me -a (as in allocate (memnory) is more siutable). But you are the master and author of fasm, if you want that switch to be -m then I'll have to find some other "switch name". I bow before thee for thou are root. _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
29 Jun 2003, 11:37 |
|
Dryobates 01 Mar 2004, 21:45
Is that feature is enabled in Linux version? I don't see it
I run compiler end it tells me that there's now free memory. I've got 300MB free memory (640MB total). If Linux version uses half of memory then it's too much for my purposes. It is a little difficult to recompile fasm sources with other values since there's almost always half of the memory is used. Is that line switching feature is forgotten? (Fasm 1.51, FreeBSD 5.1). |
|||
01 Mar 2004, 21:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.