delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/13/09:21:54

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: segmentation fault...
Date: 10 Aug 1997 10:51:07 GMT
Organization: The National Capital FreeNet
Lines: 30
Message-ID: <5sk6er$evr@freenet-news.carleton.ca>
References: <33E99579 DOT 8B2 AT gapeach DOT com> <33EA9842 DOT 5653 AT cornell DOT edu> <33EC3E5A DOT 5A6C AT gapeach DOT com>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet6.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp



Stack: 256K by default. Stores local vars of the current function and all
calling functions still active. Stores also the addresses to return to,
and is sometimes used to pass params to a function, especially
with varargs. Biggest causes of overflows: too many BIG local variables, or
one WAY too big, usually arrays of large dimensions or huge structs; and
unbounded recursive function calls.

Heap: The rest of memory your program can use, not taken up with code. (Or
the code migh be there too...) Parts of the heap may  be swapped to disk for
virtual memory. Global variables, static variables, module-level
variables, string constants, array constants, mallocked memory, and objects
allocated in C++ with new all are put in the heap. Real out of memory
errors (malloc returning NULL and new exceptions) usually result from
either INCREDIBLE memory use, or use on a tiny computer, or use of Windows
<grin>, or possibly unbound recursion in something that allocates memory,
such as constructors, functions with new or malloc, and the like.
It can also occur through memory "leaks" when a program dynamically
allocates, with new or malloc, a lot of stuff and deallocates and so
forth, i.e. when opening and closing documents, if there is a bug in your
code that causes some stuff allocated with malloc or new to be missed when
cleaning up.

--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019