Return to the archive index

Re: Memory allocation questions

To: scuffer@hups.apana.org.au (David Murn)
Cc: linux-8086@vger.rutgers.edu
From: Perry Harrington <pedward@sun4.apsoft.com>
Date: 	Mon, 14 Jul 1997 16:25:48 -0700 (PDT)
Newsgroups: linux.dev.8086

Memory is usually allocated in "arenas" by OSes, the beginning of
the arena has the size, a link back, and a link forward.  DOS uses this
method.  I presume Linux does this, most 32bit oses have a defragmenter
thread that walks the free block list and concatenates the free list
into contiguous chunks.  You use "remalloc" which uses the arena information
to determine what the size is.  If this doesn't exist, which I believe
it doesn't, your program must do this itself.  We *should* have a
kernel level, large granularity alloc routine, and a user level 
implementation of a fine granularity alloc routine.

--Perry

> 
> On Sat, 12 Jul 1997, Perry Harrington wrote:
> 
> > 	/* the next line makes the compiler add a stack entry of the
> > 		size of a pointer, commonly 4 bytes in 32 bit model, 2
> > 		in 16 bit */
> > 	struct foo *ptr;
> 
> Okay, this is what I wanted to know.
> 
> > 		Now, Microsoft and Borland diverge on this point,
> > 		Borland treats it as a compiler command, and Microsoft
> > 		allows it to be used to determine the size of a chunk
> > 		of memory, which technically AFAIK is incorrect */
> 
> This is a good point.  How does one find the size of the memory allocated
> then?  Or does the program have to keep track as it reallocates for
> itself?
> 
> Davey
> 

-- 
Perry Harrington       Linux rules all OSes.    APSoft      ()
email: perry@apsoft.com 			Think Blue. /\

From Unofficial Linux-8086 Mailing List Archive (ULMLA)
Maintained by Robert
Robert's Mailing List Archive Page

Archive created with babymail