RE: RE: RE: Re: Re: Implementation of Virtual Memory on Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> Let us know once you reveal it. Using that info, we can reveal how much
> RAM is left...

In "include/asm-arm/page.h"

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT		12
#define PAGE_SIZE		(1UL << PAGE_SHIFT)
#define PAGE_MASK		(~(PAGE_SIZE-1))

The page size appaers to be 4 K.

> I don't fully understand your reason, however, closer look into your
> code reveal this:
> #define PAGES 900
> #define SIGPAGE 4096
> ......
> for (i=0;i<PAGES;i++)
> 	{
> 		poarray=(char*)malloc(SIGPAGE);
> 		memset(poarray, '\0', SIGPAGE);
> 		if(poarray==NULL)
> 		{
> 			printf("\nError in allocating\n");
> 			exit(1);
> 		}
> 	}
>
> That means, you allocate --> 900 *4096 = 900 * 4kilobyte= 3600 kilobyte.
> "poarray" itself is assigned new memory block on each iteration (user
> space sees it at virtual continous memory block, while physically it
> could be non contigous).

My purpose of doing this is that I want to reserve this much memory, so that
they are not taken into consideration when I am allocating memory in another
loop.

> So far I try to conclude:
> 1. You're experiencing memory fragmentation. This makes memory allocator
> works harder to satisfy memory allocation.

Why so, as there is a request of just one page?

> 2. You're really lack of free memory. Especially, since looking that
> you're allocating 3600 kilobyte shortly after main() is executed.

Yes. But again there is much space left, (Kernel + drivers(Is driver memory
is separate from Kernel memory?) + poarray) < 16 MB

> 3. As side effect, you're experiencing memory leak.
>

Regards,
Abu.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux