For some reason the kernel or uClibc seem to leak memory everytime I start new processes from a shell. Update: This issue is fixed now... If UCLIBC_UCLINUX_BROKEN_MUNMAP was defined, then we can't use the mmap() in uClibc/libc/unistd/exec.c and it's object-file __exec_alloc.o For now, use alloca() instead... diff -r uClibc/libc/unistd/Makefile uClibc/libc/unistd.old/Makefile 33d32 < ifneq ($(strip $(UCLIBC_UCLINUX_BROKEN_MUNMAP)),y) 35d33 < endif diff -r uClibc/libc/unistd/exec.c uClibc/libc/unistd.old/exec.c 44c44 < #if defined(__UCLIBC_HAS_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__) --- > #ifdef __UCLIBC_HAS_MMU__ I don't know about this comment, but using alloca() works for me... /* We do not have an MMU, so using alloca() is not an option. * Less obviously, using malloc() is not an option either since * malloc()ed memory can leak in a vfork() and exec*() situation. * Therefore, we must use mmap() and unmap() directly. */ ------------------------------- When I started to use my evaluation board, I downloaded snapgear-3.0.0.tar.gz and made some tests. First I used linux-2.4.x and uC-libc and everything seemed to work without any problems. I needed some support for pthreads and then I had to use uClibc instead. I filled the 1Mb flash-memory pretty quick, and I turned on the shared library support to save some space. I guess it was at this point I noticed some instability and the kernel got out of memory. I have tried to figure out why and where the problem is, but I'm not really sure what to do. There are many factors that are involved, and it doesn't seem to be many users who have used my evaluation board MCF5206eC3... at least not with 32Mb RAM (instead of the original 4Mb) The problem occurs in these two configurations: (Both use Linux 2.4.22-uc0 and uClibc 0.9.26) http://home.mag.cx/uclinux/memory_leak/my_config/noshared/ http://home.mag.cx/uclinux/memory_leak/my_config/shared/ The first does NOT use any shared libraries, and the second is configured with CONFIG_BINFMT_SHARED_FLAT etc... http://home.mag.cx/uclinux/memory_leak/leak_free_noshared.txt http://home.mag.cx/uclinux/memory_leak/leak_free_shared.txt If I look in the /proc/slabinfo I can see that the 4096 & 32 bytes allocation raises constantly after starting new processes with both sh and hush as shell. (to be more exactly it's two 32-byte blocks and one 4096-byte block) --- I have made some simple loops with vfork and malloc, such test applications doesn't leak any memory while running. The leakage is only showed in the shell process when a started application exits, even for a simple hello world program. I have later some simple loops with vfork and execl("/bin/true"), and that loop leak memory to the main-process every time. Could it be uClibc/unistd/exec.c that leaks since it doesn't check if UCLIBC_UCLINUX_BROKEN_MUNMAP is defined? /Christian