public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* virtual memory exhausted: Cannot allocate memory
@ 2022-11-30  7:19 Mathieu Malaterre
  2022-11-30  7:29 ` Florian Weimer
  0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Malaterre @ 2022-11-30  7:19 UTC (permalink / raw)
  To: gcc-help

Hi all,

I am having a hard time understanding which flags to change in case of
`virtual memory exhausted: Cannot allocate memory`. I can compile
openvdb on all Debian supported arches but mipsel. I tried tweaking
the debug level as well as the optimization level without luck so far.

Latest attempt is:

g++-12 [...] -g0 -O0 --param ggc-min-expand=0 --param
ggc-min-heapsize=131072 [...]

What should I try next ?

Thanks much,
-- 
Mathieu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virtual memory exhausted: Cannot allocate memory
  2022-11-30  7:19 virtual memory exhausted: Cannot allocate memory Mathieu Malaterre
@ 2022-11-30  7:29 ` Florian Weimer
  2022-12-01  7:42   ` Mathieu Malaterre
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2022-11-30  7:29 UTC (permalink / raw)
  To: Mathieu Malaterre via Gcc-help; +Cc: Mathieu Malaterre

* Mathieu Malaterre via Gcc-help:

> I am having a hard time understanding which flags to change in case of
> `virtual memory exhausted: Cannot allocate memory`. I can compile
> openvdb on all Debian supported arches but mipsel. I tried tweaking
> the debug level as well as the optimization level without luck so far.
>
> Latest attempt is:
>
> g++-12 [...] -g0 -O0 --param ggc-min-expand=0 --param
> ggc-min-heapsize=131072 [...]
>
> What should I try next ?

It could be a compiler bug.  GCC might try to allocate infinite amounts
or just way too much memory.

Perhaps you can build with -save-temps, capture the preprocessed .i
file, and then try to reproduce the issue with a cross-compiler using
that .i file?

Thanks,
Florian


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virtual memory exhausted: Cannot allocate memory
  2022-11-30  7:29 ` Florian Weimer
@ 2022-12-01  7:42   ` Mathieu Malaterre
  2022-12-01 12:30     ` Stefan Ring
  0 siblings, 1 reply; 4+ messages in thread
From: Mathieu Malaterre @ 2022-12-01  7:42 UTC (permalink / raw)
  To: Florian Weimer; +Cc: Mathieu Malaterre via Gcc-help

On Wed, Nov 30, 2022 at 8:30 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Mathieu Malaterre via Gcc-help:
>
> > I am having a hard time understanding which flags to change in case of
> > `virtual memory exhausted: Cannot allocate memory`. I can compile
> > openvdb on all Debian supported arches but mipsel. I tried tweaking
> > the debug level as well as the optimization level without luck so far.
> >
> > Latest attempt is:
> >
> > g++-12 [...] -g0 -O0 --param ggc-min-expand=0 --param
> > ggc-min-heapsize=131072 [...]
> >
> > What should I try next ?
>
> It could be a compiler bug.  GCC might try to allocate infinite amounts
> or just way too much memory.
>
> Perhaps you can build with -save-temps, capture the preprocessed .i
> file, and then try to reproduce the issue with a cross-compiler using
> that .i file?

If I understand correctly, the issue is really memory pressure on
mipsel build machine. Steps:

[...]
malat@eller ~/openvdb/obj-mipsel-linux-gnu/openvdb_ax/openvdb_ax
 % time /usr/bin/c++  -save-temps -DBOOST_ALL_NO_LIB
-DBOOST_IOSTREAMS_DYN_LINK -DOPENVDB_AX_DLL -DOPENVDB_AX_PRIVATE
-DOPENVDB_AX_REGENERATE_GRAMMAR -DOPENVDB_DLL
-DOPENVDB_USE_DELAYED_LOADING -DOPENVDB_USE_LOG4CPLUS -D_GNU_SOURCE
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Dopenvdb_ax_shared_EXPORTS
-I/home/malat/openvdb/openvdb_ax/openvdb_ax/..
-I/home/malat/openvdb/openvdb_ax/openvdb_ax/../../openvdb_cmd/vdb_ax
-I/home/malat/openvdb/obj-mipsel-linux-gnu/openvdb_ax/openvdb_ax/openvdb_ax/grammar
-I/home/malat/openvdb/openvdb/openvdb/..
-I/home/malat/openvdb/obj-mipsel-linux-gnu/openvdb/openvdb
-I/home/malat/openvdb/obj-mipsel-linux-gnu/openvdb/openvdb/openvdb
-isystem /usr/lib/llvm-14/include -isystem /usr/include/Imath -g0 -O0
-ffile-prefix-map=/home/malat/openvdb=. -fstack-protector-strong
-Wformat -Werror=format-security --param ggc-min-expand=0 --param
ggc-min-heapsize=131072 -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC
-std=c++17 -MD -MT
openvdb_ax/openvdb_ax/CMakeFiles/openvdb_ax_shared.dir/compiler/VolumeExecutable.cc.o
-MF CMakeFiles/openvdb_ax_shared.dir/compiler/VolumeExecutable.cc.o.d
-o CMakeFiles/openvdb_ax_shared.dir/compiler/VolumeExecutable.cc.o -c
/home/malat/openvdb/openvdb_ax/openvdb_ax/compiler/VolumeExecutable.cc
virtual memory exhausted: Cannot allocate memory
/usr/bin/c++ -save-temps -DBOOST_ALL_NO_LIB -DBOOST_IOSTREAMS_DYN_LINK
        40048.52s user 4.21s system 99% cpu 11:07:54.46 total
% du -sh ./CMakeFiles/openvdb_ax_shared.dir/compiler/VolumeExecutable.cc.ii
6.7M    ./CMakeFiles/openvdb_ax_shared.dir/compiler/VolumeExecutable.cc.ii
% cp ./CMakeFiles/openvdb_ax_shared.dir/compiler/VolumeExecutable.cc.ii /tmp
[...]

Then:

malat@amd64 % scp eller.debian.org:/tmp/VolumeExecutable.cc.ii .
malat@amd64 % time /usr/bin/mipsel-linux-gnu-g++-12 -o
VolumeExecutable.o -c VolumeExecutable.cc.ii
/usr/bin/mipsel-linux-gnu-g++-12 -o VolumeExecutable.o -c   853.28s
user 4.38s system 99% cpu 14:17.94 total

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: virtual memory exhausted: Cannot allocate memory
  2022-12-01  7:42   ` Mathieu Malaterre
@ 2022-12-01 12:30     ` Stefan Ring
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Ring @ 2022-12-01 12:30 UTC (permalink / raw)
  To: Mathieu Malaterre via Gcc-help

On Thu, Dec 1, 2022 at 8:43 AM Mathieu Malaterre via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> If I understand correctly, the issue is really memory pressure on
> mipsel build machine. Steps:

Yes. So your options should be obvious:

- Don't run any compile jobs in parallel (I think you're not doing this anyway)
- Increase system memory (likely not possible)
- Increase swap size
- Use an older compiler
- Cross-compile on a beefier machine

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-01 12:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30  7:19 virtual memory exhausted: Cannot allocate memory Mathieu Malaterre
2022-11-30  7:29 ` Florian Weimer
2022-12-01  7:42   ` Mathieu Malaterre
2022-12-01 12:30     ` Stefan Ring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).