Return to the archive index

Re: Memory allocation questions

To: scuffer@hups.apana.org.au
Cc: 
From: "Joel N. Weber II" <devnull@gnu.ai.mit.edu>
Date: 	Sat, 12 Jul 1997 03:47:52 -0400
Newsgroups: linux.dev.8086

In general, local variables are stored on the stack.  So the stack
grows by an appropriate amount when you enter the function.  Globals
are stored in a part of the program for global variables.

malloc is only really used for dynamic allocation.

   Date: 	Thu, 10 Jul 1997 14:20:18 +1000 (EST)
   From: David Murn <scuffer@hups.apana.org.au>
   X-Sender: scuffer@grunge.hpy.hell
   MIME-Version: 1.0
   Content-Type: TEXT/PLAIN; charset=US-ASCII
   X-Orcpt: rfc822;linux-8086@vger.rutgers.edu
   Sender: owner-linux-8086@vger.rutgers.edu
   Precedence: bulk

   Hi all,
	   I've been trying to figure out how bcc/ld/ELKS allocates memory in
   kernel space.  I can see the mm_malloc function exists, but I cannot find
   any code which calls this function.  Is there another way to get memory?

   My second question, is when bcc compiles a progam, and it has, for example
   the following code.

   struct foo {
     int dog;
     int cat;
     unsigned char cow;
   };

   Then, in a function, if we have:

     struct foo *ptr;

   Does bcc automatically allocate space for 'ptr' being sizeof(foo)?  If
   not, then can someone please explain why none of the kernel code
   malloc()'s it's pointers?

   Davey

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

Archive created with babymail