This is a discussion on Building MySQL Under low memory conditions (CFLAGS not working?) within the MySQL General forum forums, part of the MySQL category; --> Hi, I'm trying to build MySQL 4.1.22 on a VPS where it looks like our available memory could be ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm trying to build MySQL 4.1.22 on a VPS where it looks like our available memory could be as low as 32MB, and compilation is erroring out partway through with a "virtual memory exhausted: cannot allocate memory" message. I tried invoking configure with the "--with-low-memory" flag, and then recompiling, and was still bumping up against the same issue. So I went looking for any other info I could find out on the net, and did find some specific info about flags you can feed to gcc to keep memory usage low here: http://hostingfu.com/article/compili...low-memory-vps However, near as I can tell, when I add the flags --param ggc-min-expand=0 and --param ggc-min-heapsize=8192 to CFLAGS in the Makefile in the top-level source directory, nothing changes. The output of make seems to indicate it's using the same flags as before I changed the makefile. In fact, it looks like I can remove CFLAGS entirely or change it to something like CFLAGS = --hovercraft-full-of-eels and nothing changes. Any obvious things I'm missing? Ideas for other things I could try? Thanks, Weston |
| |||
| Hi Weston, all, Weston C wrote: > Hi, > > I'm trying to build MySQL 4.1.22 on a VPS where it looks like our > available memory could be as low as 32MB, and compilation is erroring > out partway through with a "virtual memory exhausted: cannot allocate > memory" message. 32 MB isn't much, nowadays - consider the complexity of C++ and the amount of header files needed during compilation. Also, "virtual memory" is not just RAM, it also includes your paging space (aka "swap device"): check its size and usage. > > [[...]] > > However, near as I can tell, when I add the flags --param > ggc-min-expand=0 and --param ggc-min-heapsize=8192 to CFLAGS in the > Makefile in the top-level source directory, nothing changes. The > output of make seems to indicate it's using the same flags as before I > changed the makefile. In fact, it looks like I can remove CFLAGS > entirely or change it to something like CFLAGS = > --hovercraft-full-of-eels and nothing changes. > > Any obvious things I'm missing? Ideas for other things I could try? AFAIK, the CFLAGS value in a Makefile is not automatically passed to "make" runs in subdirectories. Better try this: cd <top-level-dir> configure <your-options-here> CFLAGS="--param ggc-min-expand=0 --param ggc-min-heapsize=8192" make This way, you have the setting in the environment, and that is inherited (unless modified). HTH, Joerg -- Joerg Bruehe, Senior Production Engineer MySQL AB, www.mysql.com |
| |||
| Joerg Bruehe <joerg@mysql.com> wrote: > Also, "virtual memory" is not just RAM, it also includes your paging > space (aka "swap device"): check its size and usage. This is a really good point. Are there some other parameters (either compiler or environment) I should be trying to tweak in addition to ggc-min-expand and ggc-min-heapsize? > AFAIK, the CFLAGS value in a Makefile is not automatically passed to > "make" runs in subdirectories. That's exactly it. I just verified it by changing the CFLAGS and other variables in a sub-directory Makefile, and sure enough, they work there. Interesting! > Better try this: > > cd <top-level-dir> > configure <your-options-here> > CFLAGS="--param ggc-min-expand=0 --param ggc-min-heapsize=8192" make This totally works -- thank you! At least, it gets me further in the compilation process. It seems even with those flags, I'm still getting the "virtual memory exhausted" error.... just much later instead of almost right off the bat. So I guess I'm back to wondering if there might not be other parameters I should try tweaking. Thanks, Weston |
| ||||
| Hi Weston, all! Weston C wrote: > Joerg Bruehe <joerg@mysql.com> wrote: >> Also, "virtual memory" is not just RAM, it also includes your paging >> space (aka "swap device"): check its size and usage. > > This is a really good point. Are there some other parameters (either > compiler or environment) I should be trying to tweak in addition to > ggc-min-expand and ggc-min-heapsize? If your RAM is limited, you will profit from running as few programs as possible, and configuring these to use as little address space as possible. Specifically about gcc, I cannot give any hint. Our build environments, be it central servers or local workstations, have much more RAM. > >> AFAIK, the CFLAGS value in a Makefile is not automatically passed to >> "make" runs in subdirectories. > > That's exactly it. I just verified it by changing the CFLAGS and other > variables in a sub-directory Makefile, and sure enough, they work > there. Interesting! That's like the difference between a local and an exported shell variable. > >> Better try this: >> >> cd <top-level-dir> >> configure <your-options-here> >> CFLAGS="--param ggc-min-expand=0 --param ggc-min-heapsize=8192" make > > This totally works -- thank you! At least, it gets me further in the Good to hear ! > compilation process. It seems even with those flags, I'm still getting > the "virtual memory exhausted" error.... just much later instead of > almost right off the bat. So I guess I'm back to wondering if there > might not be other parameters I should try tweaking. The only other thing that comes to my mind is to avoid parallel make runs - best use "make -j 1" explicitly. I repeat: Check your swap space size and its use. If that server is a Linux machine, try cat /proc/swaps On my home PC, the current output is Filename Type Size Used Priority /dev/hda6 partition 987988 28056 42 (964 MB configured, 27 MB used - this is with two builds running in parallel on 1 GB of RAM, plus the interactive use with KDE, Firefox, Thunderbird, IRC, ...). Also, use "ps" to check for the address space used by running processes. Good luck ! Joerg -- Joerg Bruehe, Senior Production Engineer MySQL AB, www.mysql.com |