delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/28/10:00:57

From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: question to malloc and free
Date: Fri, 28 Aug 1998 14:56:20 +0200
Organization: University of Ghent, Belgium
Lines: 19
Message-ID: <35E6A8F4.1D40@rug.ac.be>
References: <m0zC8Ic-000S4JC AT inti DOT gov DOT ar>
NNTP-Posting-Host: eduserv1.rug.ac.be
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Salvador Eduardo Tropea (SET) wrote:
> 
> califax AT wupperonline DOT de (Klaus Petzold) wrote:
> 
> > when I allocate a memory block with malloc and release it with free,
> > how does free know how much it has to release? Stores malloc
> > some information about the block?
> 
> Yes malloc stores this information at the beggining of the block.

However, treat that information as implementation defined. Some malloc
implementations for other platforms store different info at the
beginning. Some implementations don't even store anything at all at the
beginning of the block.

-- 
 \ Vik /-_-_-_-_-_-_/
  \___/ Heyndrickx /
   \ /-_-_-_-_-_-_/  Knight in the Order of the Unsigned Types

- Raw text -


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