[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: stack and heap size documentation



> From: "Eric G. Miller" <egm2@jps.net>



> Your probably corrupting memory somewhere.  AFAIK, "new" should only
> fail if you're totally out of memory (and then do so in a predictable
> manner).  Segfaults are rarely due to programming errors in the
> compiler and standard library.

But remember that the kernel does not reserve the virtual memory 
for you when you call new/malloc().  It allocates virtual pages 
to your process only when your process first accesses each page.

Therefore, if your process allocates more memory than is currently
available on the system, it won't see a problem when it calls
malloc(), but it will get a segfault signal when it accesses one
page too many.



Daniel
-- 
Daniel Barclay
dsb@smart.net


-- 
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: