chyyuu / ucore_os_plus

232 stars 132 forks source link

Assertion "nr_used_pages_store == nr_used_pages()" fails #2

Closed eternalNight closed 12 years ago

eternalNight commented 12 years ago

Description

In the checks after all user-mode processes quits, the assertion "nr_used_pages_store == nr_used_pages()" always fails, which means some pages allocated has not been properly freed.

Commit

b8ad77a unittest: Bring in the complete set of tests from the original uCore.

Reproduce Steps

cd ucore make ARCH=i386 menuconfig make kernel make sfsimg make swapimg ./uCore_run (Press Ctrl-C in Qemu)

Current Result

From the serial port: "kernel panic at proc.c:1634:" " assertion failed: nr_used_pages_store == nr_used_pages()"

Expected Result

From the serial port: "init check memory pass" init check memory pass.

eternalNight commented 12 years ago

The root cause of this issue is a typical memory leak. The memory allocated as an environment variable array in do_execve(), pointed by kenvp, is not properly freed when the function ends successfully.