[cgl_discussion] Re: AEM memory management

Frederic Rossi (LMC) Frederic.Rossi at ericsson.ca
Fri Mar 21 06:00:55 PST 2003

Dave Olien wrote:

>Reading the section of your article on Memory Management.
>I'm sure I could answer these questions by reading source code.
>But, it's easier just to ask.
I know Dave. No problem!

>You talk about two memory allocation schemes, one using the
>process's heap, the other using a kernel buddy allocator.  The
>memory allocation scheme can be chosen when the application is started.
Not exactly. One mem pool is used for each process and it is defined 
either  inside the process heap or
by a bunch of mapped pages.

This pool is managed by an allocator to be able to take benefit of the 
all pool for any number of
parameters. For the moment applications have to chose which scheme to use.

>When you talk about using the process's heap, is this allocation
>done by the kernel, or does the application do it somehow?
>How does this allocation interact with user-mode heap allocators
>such as malloc(), brk(), sbrk()?
Yes for allocations done iside the heap a pointer is returned to user 
space to advertise the change
via brk. Unfortunatly, this is necessary.

>When you talk about the kernel's buddy memory allocator, how is the
>allocated memory exported to user space?  Do you map kernel pages into
>user space?  
I'm not talking about the kernel's buddy memory allocator, I'm talking 
about vmtable which is an indepandant
allocator used only for the purpose of event handlers. When it's not 
defined in the heap, pages are mapped
by constructors when doing mem allocation for handlers parameters and 
unmapped by destructors.

>Each process can have a vtable (for the buddy allocator) and an
>event list. At fork() time, these may be inherited by the child
>process.  How does this interact with the CLONE_VM flag?
The same mem type is set for child processes when forking.

>What happens to the vtable and the event lists when a process does
>an exec()?
The problem if there is one, is when exec is done when running inside a 
handler because of
handler destructors. But I will check this. Thanks.

More information about the cgl_discussion mailing list