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

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

 



Hi...

> > still a lot...hmmm...what is the page size of your ARM architecture
>> anyway?
>
> hmmm.... Need to verify.

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

> This was intentional as I am not allocating the space inside the
> loop. This space has been reserved and kept used by writing some
> value in those pages. Inside the loop I am repeatedly allocating and
> deallocating the pages referred to by p2. Still I got the page
> allocation failure. No clue, Why?????

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).

So far I try to conclude:
1. You're experiencing memory fragmentation. This makes memory allocator 
works harder to satisfy memory allocation.
2. You're really lack of free memory. Especially, since looking that 
you're allocating 3600 kilobyte shortly after main() is executed.
3. As side effect, you're experiencing memory leak. 

regards

Mulyadi


--
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