bdwgc icon indicating copy to clipboard operation
bdwgc copied to clipboard

RISCV Insufficient memory for main local_mark_stack

Open tpgxyz opened this issue 5 years ago • 3 comments

I got error when i compile guile-2.2.6 for riscv64. More logs can be found here https://abf.openmandriva.org/build_lists/659746

./guile-snarf-docs -o regex-posix.doc regex-posix.c -- -DHAVE_CONFIG_H -DBUILDING_LIBGUILE=1 -I.. -I.. -I../lib -I../lib  -I/builddir/build/BUILD/guile-2.2.6  -Os -fomit-frame-pointer -gdwarf-4 -Wstrict-aliasing=2 -pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4  -march=rv64imafdc -mabi=lp64d -flto
cat alist.doc array-handle.doc array-map.doc arrays.doc async.doc atomic.doc backtrace.doc boolean.doc bitvectors.doc bytevectors.doc chars.doc control.doc continuations.doc debug.doc deprecated.doc deprecation.doc dynl.doc dynwind.doc eq.doc error.doc eval.doc evalext.doc expand.doc extensions.doc fdes-finalizers.doc feature.doc filesys.doc fluids.doc foreign.doc fports.doc gc-malloc.doc gc.doc gettext.doc generalized-arrays.doc generalized-vectors.doc goops.doc gsubr.doc guardians.doc hash.doc hashtab.doc hooks.doc i18n.doc init.doc ioext.doc keywords.doc list.doc load.doc macros.doc mallocs.doc memoize.doc modules.doc numbers.doc objprop.doc options.doc pairs.doc ports.doc print.doc procprop.doc procs.doc promises.doc r6rs-ports.doc random.doc rdelim.doc read.doc rw.doc scmsigs.doc script.doc simpos.doc smob.doc sort.doc srcprop.doc srfi-1.doc srfi-4.doc srfi-13.doc srfi-14.doc srfi-60.doc stackchk.doc stacks.doc stime.doc strings.doc strorder.doc strports.doc struct.doc symbols.doc syntax.doc threads.doc throw.doc trees.doc unicode.doc uniform.doc values.doc variable.doc vectors.doc version.doc vports.doc weak-set.doc weak-table.doc weak-vector.doc dynl.doc posix.doc net_db.doc socket.doc regex-posix.doc | GUILE_AUTO_COMPILE=0 ../meta/build-env guild snarf-check-and-output-texi          > guile-procedures.texi || { rm guile-procedures.texi; false; }
BUILDSTDERR: Insufficient memory for main local_mark_stack
BUILDSTDERR: /bin/sh: line 1:  6166 Broken pipe             cat alist.doc array-handle.doc array-map.doc arrays.doc async.doc atomic.doc backtrace.doc boolean.doc bitvectors.doc bytevectors.doc chars.doc control.doc continuations.doc debug.doc deprecated.doc deprecation.doc dynl.doc dynwind.doc eq.doc error.doc eval.doc evalext.doc expand.doc extensions.doc fdes-finalizers.doc feature.doc filesys.doc fluids.doc foreign.doc fports.doc gc-malloc.doc gc.doc gettext.doc generalized-arrays.doc generalized-vectors.doc goops.doc gsubr.doc guardians.doc hash.doc hashtab.doc hooks.doc i18n.doc init.doc ioext.doc keywords.doc list.doc load.doc macros.doc mallocs.doc memoize.doc modules.doc numbers.doc objprop.doc options.doc pairs.doc ports.doc print.doc procprop.doc procs.doc promises.doc r6rs-ports.doc random.doc rdelim.doc read.doc rw.doc scmsigs.doc script.doc simpos.doc smob.doc sort.doc srcprop.doc srfi-1.doc srfi-4.doc srfi-13.doc srfi-14.doc srfi-60.doc stackchk.doc stacks.doc stime.doc strings.doc strorder.doc strports.doc struct.doc symbols.doc syntax.doc threads.doc throw.doc trees.doc unicode.doc uniform.doc values.doc variable.doc vectors.doc version.doc vports.doc weak-set.doc weak-table.doc weak-vector.doc dynl.doc posix.doc net_db.doc socket.doc regex-posix.doc
BUILDSTDERR:       6168 Aborted                 (core dumped) | GUILE_AUTO_COMPILE=0 ../meta/build-env guild snarf-check-and-output-texi > guile-procedures.texi
BUILDSTDERR: make[3]: *** [Makefile:4281: guile-procedures.texi] Error 1

tpgxyz avatar Dec 19 '19 11:12 tpgxyz

The code which produces this fail is:

    size_t bytes_to_get =
                ROUNDUP_PAGESIZE_IF_MMAP(LOCAL_MARK_STACK_SIZE * sizeof(mse));
    GC_main_local_mark_stack = (mse *)GET_MEM(bytes_to_get);
    if (NULL == GC_main_local_mark_stack)
      ABORT("Insufficient memory for main local_mark_stack");
    GC_add_to_our_memory((ptr_t)GC_main_local_mark_stack, bytes_to_get);

The maybe 2 reasons of GET_MEM() to return 0:

  • GC_page_size is 0 somehow (it should not happen because the variable should be set during GC_init, anyway I will add an assertion here about it)
  • Really lack of memory, amount of allocated memory here is HBLKSIZE * sizeof(word) * 2 (HBLKSIZE should be 4096 for this target by default)

ivmai avatar Sep 08 '20 07:09 ivmai

I've added extra assertions to check whether GC_page_size is initialized (including the code place mentioned above) - 57b97be07 If you manage to reproduce the issue (Insufficient memory for ...) with this change, then it is caused by real lack of memory.

ivmai avatar Sep 17 '20 05:09 ivmai

Is this still reproducible on fresh master? (Ideally if reproduced on latest H/W, like HiFive Unmatched mentioned in #212)

ivmai avatar Sep 28 '21 06:09 ivmai

I failed to reproduce it locally (gcc92)

ivmai avatar May 12 '23 14:05 ivmai