[Gc] Re: GC_MALLOC() Failure

Volkan YAZICI yazicivo at ttmail.com
Mon May 10 11:05:51 PDT 2010


On Mon, 10 May 2010, Andrew Haley <aph at redhat.com> writes:
> The easiest way is to use strace on the mmap() calls.

Sorry, I couldn't understand what you mean. Could you be more elaborate
please? I know which GC_MALLOC() calls fail for which particular sizes
-- eg. in my case it fails for GC_MALLOC(99532800) expression -- but I
don't how to make GC_MALLOC() use the remaning of the available memory.

And for strace output, here are the last words of the execution:

  open("repl-ilp-xjXjwG", O_RDONLY)       = 12
  fstat(12, {st_mode=S_IFREG|0600, st_size=907, ...}) = 0
  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7e4752a000
  read(12, "maximize\n  1 x0 + 1 x1 + 1 x2 + 1"..., 4096) = 907
  close(12)                               = 0
  munmap(0x7f7e4752a000, 4096)            = 0
  rmdir("")                               = -1 ENOENT (No such file or directory)
  unlink("repl-ilp-xjXjwG")               = 0
  times({tms_utime=48, tms_stime=23, tms_cutime=0, tms_cstime=0}) = 1748362973
  times({tms_utime=48, tms_stime=23, tms_cutime=0, tms_cstime=0}) = 1748362973
  brk(0x4ec54000)                         = 0x47d67000
  brk(0x4dc54000)                         = 0x47d67000
  write(2, "bin/repl-k: "..., 12bin/repl-k: )         = 12
  write(2, "gc_malloc(99532800) failed!"..., 27gc_malloc(99532800) failed!) = 27
  write(2, "\n"..., 1
  )                    = 1
  write(4, "read: 520000 cputime, 555 msecs\n"..., 32) = 32
  write(3, "inicut: 62051\niniimbal: 0.042963\n"..., 49) = 49
  exit_group(1)                           = ?

(If it'd be helpful, I can also send the whole strace output.) And
gc_malloc() is a thin wrapper around GC_MALLOC():

  void *
  gc_malloc(size_t nbytes)
  {
      void *b;
  
      b = GC_MALLOC(nbytes);
      if (!b)
          error(1, 0, "gc_malloc(%zu) failed!", nbytes);
  
      return b;
  }


Regards.


More information about the Gc mailing list