Skip navigation.
Home
The QNX Community Portal

View topic - io-blk library dynamic memory usage/memory leak

io-blk library dynamic memory usage/memory leak

Discussion about the QNX6 OS.

io-blk library dynamic memory usage/memory leak

Postby omesh » Thu Sep 27, 2012 5:16 pm

Hi,

I am running my system for long time continuously and monitoring the memory usage of all components running in system. I see the increase in memory usage of devb-eide and other drivers that are using io-blk.so library for block I/O. I think the memory is allocated for vnodes created dynamically whenever i am doing for disk operations. However i want to know whether the increase in memory usage will stop at some point of time and how can i determine when any further increase should stop.?
I also want to know what are the factors that can cause the increase in memory of driver at run time.?

Thanks
omesh
New Member
 
Posts: 8
Joined: Wed Jul 07, 2010 7:02 am

Re: io-blk library dynamic memory usage/memory leak

Postby Tim » Thu Sep 27, 2012 6:29 pm

Omesh,

By default io-blk increases it's memory use until it reaches 15% of the system RAM. This can be adjusted up/down by a parameter given to io-blk when devb-eide (and other drivers) are started.

You can also pre-allocate all the RAM at start time so that it doesn't grow dynamically if you prefer to see the max usage.

Take a look at the help doc's on io-blk.so for more details.

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: io-blk library dynamic memory usage/memory leak

Postby omesh » Thu Sep 27, 2012 7:21 pm

Hello Tim,
Thanks for the reply.
I have set the options of alloc=upfront and cache=64K.Once i set these options i should not see any growth at run time and memory should not grow dynamically beyond 64KB ,but this is not the case happening on my system. Is there any other parameter that i should set in order to completely stop the growth at runtime.?

Thanks,
omesh
New Member
 
Posts: 8
Joined: Wed Jul 07, 2010 7:02 am

Re: io-blk library dynamic memory usage/memory leak

Postby maschoen » Fri Sep 28, 2012 12:18 am

omesh wrote:Hello Tim,
Thanks for the reply.
I have set the options of alloc=upfront and cache=64K.Once i set these options i should not see any growth at run time and memory should not grow dynamically beyond 64KB ,but this is not the case happening on my system. Is there any other parameter that i should set in order to completely stop the growth at runtime.?

Thanks,


I'm just guessing here, but 64K is a tiny amount of memory (these days) for use as the disk cache. I wouldn't be surprised if that number is being ignored, or pushed up to some more reasonable minimum.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: io-blk library dynamic memory usage/memory leak

Postby omesh » Fri Sep 28, 2012 6:19 pm

If i am setting the cache=512KB ,i am able to see the growth at run time even though i have set the alloc=upfront in options.what is the reason for this behavior. ?

Thanks,
omesh
New Member
 
Posts: 8
Joined: Wed Jul 07, 2010 7:02 am

Re: io-blk library dynamic memory usage/memory leak

Postby maschoen » Fri Sep 28, 2012 7:12 pm

omesh wrote:If i am setting the cache=512KB ,i am able to see the growth at run time even though i have set the alloc=upfront in options.what is the reason for this behavior. ?

Thanks,


I think you will have to ask on the QNX support boards. The source was never released (as far as I can tell). It might well be an oversight or a bug.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: io-blk library dynamic memory usage/memory leak

Postby Tim » Mon Oct 01, 2012 4:38 pm

I think 512K is still probably WAY under the minimum.

A typical system these days has 1 Gig of Ram. 512K is .0005% of the RAM. Even if you only have 512 Megs of Ram, 512K is .001% or 1/10 of 1%.

I suspect 1% is probably the default minimum percentage so on a 1 Gig system than would be 10 Megs.

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: io-blk library dynamic memory usage/memory leak

Postby omesh » Tue Oct 02, 2012 2:36 pm

Thanks Tim,

My system has 256MB of RAM and 256MB of Flash Drive with four partitions. Even though i am setting cache of 10MB upfront with fixed vonde count,I still see the heap usage of devb-eide driver increasing at run time.
(cmd line options:alloc=upfront,auto=partition,cache=10240k,vnode=200:200).

I am executing following sample program on different partitions to reproduce the increase in heap memory . But i am not able to figure out what could cause this memory increase and what would be the limit when it should stop increasing further.

for(i=0; i<=1000; i++)
{
sprintf(filename, "%s%d.txt", "file",i+1);
if( ( fp = fopen(filename, "a+") ) == NULL )
{
printf("Error: File \"%s\ %d\" cannot be opened\n", filename,errno);
}
else
{
for(k=0;k<1000;k++)
{
fprintf( fp, "%s", "Hello There");
}
fclose(fp);
}
}
(Basically i am trying to create n number of files and write some data into the file. )
If i am setting the alloc=upfront option i should not see any increase in the memory at run time. ?

Thanks,
omesh
New Member
 
Posts: 8
Joined: Wed Jul 07, 2010 7:02 am

Re: io-blk library dynamic memory usage/memory leak

Postby mario » Tue Oct 02, 2012 8:38 pm

The option are just for the cache, devb/io-blk may require more memory for other purposes. You are also limiting vnode to 200, but are opening 1000 files. Note sure how it`s handled.

I would also be the memory consumption would stop increasing otherwise any QNX6 system out there would be in serious trouble.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: io-blk library dynamic memory usage/memory leak

Postby omesh » Tue Oct 02, 2012 9:07 pm

Hello mario,

I tried with different values of vnodes and observed the memory usage of the driver after initialization increases as i increase the vnode count(May be more Memory is required for more number of vnodes and additional memory is allocated in initialization itself since i have provided alloc=upfront option ).
I also tried to set the value to default(max) and ran the same test case and i could still see the memory usage increasing at runtime

I am looking for that either i can figure out how to prevent any increase at run time and allocate all the memory during initialization or find out when the increase in memory would stop and for that i should know where is memory is required at run time ?

Thanks,
omesh
New Member
 
Posts: 8
Joined: Wed Jul 07, 2010 7:02 am

Re: io-blk library dynamic memory usage/memory leak

Postby mario » Thu Oct 04, 2012 2:38 pm

omesh wrote:Hello mario,

I tried with different values of vnodes and observed the memory usage of the driver after initialization increases as i increase the vnode count(May be more Memory is required for more number of vnodes and additional memory is allocated in initialization itself since i have provided alloc=upfront option ).
I also tried to set the value to default(max) and ran the same test case and i could still see the memory usage increasing at runtime

I am looking for that either i can figure out how to prevent any increase at run time and allocate all the memory during initialization or find out when the increase in memory would stop and for that i should know where is memory is required at run time ?

Thanks,


At think at this point you have exhausted all the help this site can offer ;-) You will need to get in touch with QNX
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

Re: io-blk library dynamic memory usage/memory leak

Postby Tim » Thu Oct 04, 2012 5:07 pm

I agree with Mario you may have to contact QNX.

Many of our systems stay up for months at a time without re-booting. I have never run out of RAM or seen devb-eide or other drivers use an enormous amount of it. On the other hand none of my systems ever attempts to create 1000 files IN ONE DIRECTORY either :shock:

I do recall a long time ago there was a problem (can't remember if it was QNX 4 or 6 or both) where putting a large number of files in one directory (a 1000 is a large number) caused some issues. I can't remember all the details now but maybe Mario or Mitchell will remember.

Tim
Tim
Senior Member
 
Posts: 1388
Joined: Wed Mar 10, 2004 12:28 am

Re: io-blk library dynamic memory usage/memory leak

Postby maschoen » Fri Oct 05, 2012 12:54 am

Well certainly QNX 2 had a problem with a large number of files in a directory. I remember talking with Bill Flowers the improvements he put into the QNX 4 file system to deal with this. I also recall that there was some standard open source used at the time for posting that required huge numbers of files in a directory, which did work quite well with it.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm


Return to QNX6 - OS

Who is online

Users browsing this forum: No registered users and 4 guests

cron