This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: reg: GDB's generate-core-file option


On Tuesday 29 September 2009 05:29:35, Michael Snyder wrote:

> > The
> > problem is that for one process i get the following error.
> > 
> > warning: Failed to write corefile contents (No space left on device).
> > ../../gdb/utils.c:1058: internal-error: virtual memory exhausted:
> > can't allocate 92123136 bytes.
> 
> This is an out-of-memory error.  It comes from function "nomem()"
> in utils.c, and results from the failure of an xmalloc() call.
> 
> There is only one xmalloc() call in gcore.c, it looks like this:
> 
>    memhunk = xmalloc (size);

A bit more context around that line on current-ish GDB sources,
shows:

  size = min (total_size, MAX_COPY_BYTES);
  memhunk = xmalloc (size);

and MAX_COPY_BYTES is described as:

 /* The largest amount of memory to read from the target at once.  We
    must throttle it to limit the amount of memory used by GDB during
    generate-core-file for programs with large resident data.  */
 #define MAX_COPY_BYTES (1024 * 1024)

If this is a recent GDB, it can't be that particular xmalloc call.
You must have an old GDB?  This MAX_COPY_BYTES cap was added in 2006.

> > warning: Failed to write corefile contents (No space left on device).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note that this happens before gdb's internal error.  You're already going
to end up with a partial core.

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]