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: [RFC] What to do on VM exhaustion


Kip Macy wrote:

On 1/5/06, *Michael Snyder* <michsnyd@cisco.com <mailto:michsnyd@cisco.com>> wrote:


    Kip Macy wrote:
     > Why not just pre-allocate a small arena at startup for an "emergency"
     > malloc? Hardly ideal, but it would allow gdb to fail gracefully.

Wouldn't that require modifying malloc?


Or do you have in mind that, on detecting out-of-VM, we would free our little reserved chunk, thus making it available for libc (or whatever)?


What I had in mind was that if we detect out-of-VM we set a flag so that internal_error would allocate memory from the pre-allocated emergency memory.

Internal error doesn't allocate memory. It calls query, which calls something else, which eventually calls malloc. Hence we would have to change the behavior of malloc.

> Or, if there were some way of recovering, but it required some
interim memory, you could allocate from the emergency memory in the recovery path.

Well, all allocation is ultimately done by malloc. OK with some exceptions, but in general, that's where we're hitting the problem. This sounds like modifying malloc.

On the other hand, the idea of freeing an emergency reserve just before
calling query might have some virtue...



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