Hello, I recently bought a chromebook that has very limited resources but I would like to use it to compile projects for the Gameboy. SDCC/LCC seems to crash due to lack of RAM and I don't have a lot of storage space for swap. Is there a way to limit the amount of RAM used when compiling? Like a flag I can add to the makefile? I don't mind if it takes longer for the project to compile, I just don't want it to keep crashing. Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
RAM usage depends on the --max-allocs-per-node argument. The default is 3000, which should not be a problem. But many people use far higher values (resulting in far higher RAM usage and compile times, and better optimization).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you are writing new code, i.e. can shape it however you like, working with a larger number of smaller files and keeping functions reasonably small can help reduce RAM usage within the compiler.
If you use a lot of macros, switching off macro expansion in the preprocessor's diagnostic messages can also help, because the underlying internal data structures in the preprocessor can get quite big. This is actually not SDCC-specific, but affects everything that uses the GNU preprocessor.
You could try preprocess your source code first and to compile the preprocessed code later. That way you can find out which step uses too much RAM in your case.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, I recently bought a chromebook that has very limited resources but I would like to use it to compile projects for the Gameboy. SDCC/LCC seems to crash due to lack of RAM and I don't have a lot of storage space for swap. Is there a way to limit the amount of RAM used when compiling? Like a flag I can add to the makefile? I don't mind if it takes longer for the project to compile, I just don't want it to keep crashing. Thanks!
RAM usage depends on the --max-allocs-per-node argument. The default is 3000, which should not be a problem. But many people use far higher values (resulting in far higher RAM usage and compile times, and better optimization).
If you are writing new code, i.e. can shape it however you like, working with a larger number of smaller files and keeping functions reasonably small can help reduce RAM usage within the compiler.
If you use a lot of macros, switching off macro expansion in the preprocessor's diagnostic messages can also help, because the underlying internal data structures in the preprocessor can get quite big. This is actually not SDCC-specific, but affects everything that uses the GNU preprocessor.
You could try preprocess your source code first and to compile the preprocessed code later. That way you can find out which step uses too much RAM in your case.