X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f From: Charles Sandmann Newsgroups: comp.os.msdos.djgpp Subject: malloc memory [was Re: Alignment problem] Date: Mon, 11 Feb 2002 10:18:30 CST Organization: Rice University, Houston TX Lines: 13 Message-ID: <3c67eed6.sandmann@clio.rice.edu> References: <3C67DE6D DOT DEE8305C AT yahoo DOT com> NNTP-Posting-Host: clio.rice.edu X-Trace: joe.rice.edu 1013444747 23994 128.42.105.3 (11 Feb 2002 16:25:47 GMT) X-Complaints-To: abuse AT rice DOT edu NNTP-Posting-Date: 11 Feb 2002 16:25:47 GMT X-NewsEditor: ED-1.5.9 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com > Where does malloc, realloc get the memory to manage, or what > describes it to the package? malloc manages memory out of it's own pool - when it's out it calls sbrk() to get another chunk of memory. sbrk() is in crt0.s - and is a smart wrapper around the DPMI call to get another block of memory. (DPMI only returns memory in relatively big chunks and can be slow - while sbrk() can be used for any size request). There are two sbrk() implementations available - one which behaves as much like unix-type sbrk() as possible - but causes grief to DOSism - and the default non-move sbrk() which can do very strange things to your address space.