Memory Usage Growth in File access

s.deepak s.deepak at gdatech.co.in
Mon May 2 16:52:39 EST 2005


Hi All,

I am  facing an issue in file operation, when we read/write continuously to  a large file in our  ppc 405 based device , memory usage shown in /proc/meminfo   increases by the number of bytes accessed.And after closing the application also the memory used is not released and  it goes to cached memory .
We are using 2.4.20 kernel in our device.We are not sure whether the /proc/meminfo shows the erroneous output or the file read/write routines got any problem.
Can anyone suggest me some idea how to trace out the problem.

I have given the sample code  below.
The memory consumption grows and it takes about 10 MB memory space [10000 * 1024] when i run the below given code.
When i look into /proc/meminfo the free memory is reduced by 10 MB and Cache Memory & Used memory is increased by 10 mb after running this application.
When i run the below given code first time the memory grows,when  i run succesively it doesn't grow again , may be using the already taken memory.



int main()
{

FILE *fp;

unsigned long int i;
unsigned char data[1024];

fp=fopen("test.txt","r");
for(i=0;i<10000;i++)
{

      fread(data,1024,1,fp);
}
fclose(fp);
}


With Thanks & Regards,
Deepak S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20050502/6b8c670d/attachment.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: BitDefender.txt
Url: http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20050502/6b8c670d/attachment.txt 


More information about the Linuxppc-embedded mailing list