[uClinux-dev] execve

buc at larsen.st buc at larsen.st
Tue Mar 25 00:00:03 EST 2003


Thanks for your help.

I'm using a very slightly modified MOTOROLA 5272C3 configuration.  I don't
think is_in_rom is the problem: addresses just above and just below are
freed fine.

Trawling the Linux source code backs up your statement.  do_execve calls
stuff which likely calls load_flat_file which calls exec_mmap which calls
mm_release.

Allow me to display my ignorance by advancing a theory.

Boa is doing a vfork() instead of a fork().  This means the child does not
get a cloned memory space, but plays in the parent's memory space.  This
means that any malloc's the child does is done in the parent's memory space
rather than the child's.  Execve from the child just cleans up the child,
not the parent.  The memory is not freed until the parent is cleaned up,
which in my case is never.

please tell me I'm wrong.

thanks,
Bryan



> Bryan,
>
> An execve will clean up all of the memory for the current process.  The
> new process (in this case the cgi program) will replace the existing
> process (in this case boa).  It looks like the mmap structures are
> freed from within load_flat_file which is called by do_execve
> (eventually).
>
> If you are finding that the memory is not freed, then it is a bug in
> your platform.  Check that your is_in_rom macro (called from
> mmnommy/mmap.c) is defined properly.  On m68knommu it is defined in
> arch/m68knommu/mm/memory.c.
>
> Cheers
>
> Matt






More information about the uClinux-dev mailing list