In some cases, make uses too much memory. For example: [hjl@gnu-d libjava]$ make ulimit -v 1048576; \ /usr/bin/time make -f gnu-src-gcc.deps make[1]: Entering directory `/export/home/hjl/bugs/make/libjava' make[1]: *** virtual memory exhausted. Stop. make[1]: Leaving directory `/export/home/hjl/bugs/make/libjava' Command exited with non-zero status 2 5.94user 2.78system 0:22.33elapsed 39%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (279major+261891minor)pagefaults 0swaps make: *** [all] Error 2
Created attachment 122081 [details] A patch GNU make 3.80 is a HUGE memory hog. It calls xstrdup to build dependency list. gnu-src-gcc.deps in libjava has 3000+ targets depend the same 3000+ files, whose filenames are more than 260K. For this dependency alone, make takes 3000*260K == 761MB. This patch is a quick hack. It reduces the memory from 1.6GB to around 600MB for "make -f gnu-src-gcc.deps". I got [hjl@gnu-13 libjava]$ make ulimit -v 1048576; \ /usr/bin/time ./make -f gnu-src-gcc.deps make[1]: Entering directory `/export/home/hjl/bugs/make/libjava' make[1]: *** No rule to make target `../gnu/classpath/Configuration.java', needed by `lists/gnu-src-gcc.stamp'. Stop. make[1]: Leaving directory `/export/home/hjl/bugs/make/libjava' Command exited with non-zero status 2 67.10user 1.24system 1:16.63elapsed 89%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+140611minor)pagefaults 0swaps make: *** [all] Error 2
Created attachment 122083 [details] A testcase I don't know why my testcase wasn't uploaded when I opened the bug report.
Have you reported the problem upstream and posted a patch there?
Yes, see http://lists.gnu.org/archive/html/bug-make/2005-12/msg00003.html
I applied the patch. Should be in rawhide tomorrow. I'm adding review of make's memory management to my longterm TODO.
Created attachment 123984 [details] An updated patch > I just want to inform you, that we got a problem report regarding your > "memory hog" patch from 2005-Dec-08 for gmake-3.80. If compilation of > "binutils" is started with "MALLOC_CHECK_=2", a crash in gmake occurs. > > I digged a bit deeper into it and noticed this: > My memory hog patch for make has 2 typos. This patch fixes them.
Please use the new patch.
Thank you, it's in rawhide.
This issue is on Red Hat Engineering's list of planned work items for the upcoming Red Hat Enterprise Linux 4.4 release. Engineering resources have been assigned and barring unforeseen circumstances, Red Hat intends to include this item in the 4.4 release.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on the solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHEA-2006-0359.html