1

全部。

假设进程'A通过如下代码分配了很多页面。
并且 process'A 会定期执行此代码,因此会发生内存泄漏。

 // allocates 1Mb
for(i=0;i<10;i++)
{
  page_p=alloc_pages(gfp_mask, 8);
}

顺便说一句,在没有空闲页面的情况下杀死进程后分配的页面会变成什么?
分配的页面是永久泄漏的?

4

1 回答 1

0

In Linux you have virtual memory, which is a per process memory map. The processes memory is allocated from this map, and the OS maps this memory into physical memory, either RAM or swap.

When a process exits, the OS removes the processes memory map, and another process can reuse it. So leaked memory is only leaked when the process is running.

于 2013-11-15T07:17:53.380 回答