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

RE: memory leaks



Hi Mark,
Are you sure that you don't have other processes running that consumes RAM by writing to a ramfs or something? Did you get any kernel messages?

I tried your test program and I can also see a decrease of free RAM, but only until JFFS (JFFS1) has done garbage collect. Then free RAM is constant no matter how many times I run your program. I don't know how JFFS works on that level, but I think it's normal behaviour. I think that JFFS1 uses two flash blocks (2x64kB, in your case I guess) for garbage collect so you might run out of space if you write to much at once (but that ought to result in a "no space left on device"-error). I'm not sure what happens if your JFFS partition is too small for garbage collect to work (except that it's bad :) 320kB (5x64kB) should be enough, then you can use (5-2)x64kB = 192kB. 

Best regards
/Jonas Holmberg

> -----Original Message-----
> From: mschapira@xxxxxxx.com">mailto:mschapira@xxxxxxx.com]
> Sent: Monday, June 04, 2001 4:49 PM
> To: dev-etrax@xxxxxxx.com
> Subject: memory leaks
> 
> 
> I still have not gotten a response to this problem. I would 
> appreciate some
> answer.. The following message contains the entire thread of 
> communication
> thus far.
> 
> Thanks in advance.
> 
> Mark Schapira
> ---------------------- Forwarded by Mark Schapira/DEN/HID on 
> 05/22/2001
> 12:55 PM ---------------------------
> 
> 
> Mark Schapira
> 05/16/2001 09:36 AM
> 
> To:   jffs-dev@xxxxxxx.com
> cc:
> Fax to:
> Subject:  memory leaks when writing to a file in /mnt/flash
> 
> I have been communicating with Jonas Adolfsson with regard to 
> this problem.
> However, he informed me that he will be on vacation for the 
> next few days
> and he suggested that I resubmit this email to dev-etrax@xxxxxxx.com and
> dev-jffs@xxxxxxx. Below the *************** is the chain of 
> correspondance
> so far.
> 
> In answer to Jonas's latest questions.
> The problem occurs with Linux 2.4 for the Etrax 100 LX
> The results from /proc/meminfo are confusing to me because they are
> inconsistent. ie. the total uses of memory do not add up to the total
> amount of memory
> that is available so I can't determine how the memory is used.
> 
> I suspect that the problem occurs with the jffs file system 
> because I have
> mounted an nfs drive on the Linux 2.4.3 and I DO NOT experience this
> problem.
> 
> I do not know how the jffs and the flash device work (in 
> detail) so I have
> no idea how I can run out of memory  by writing records into 
> a file in the
> /mnt/flash directory. Is there any doumentation that 
> describes how the jffs
> works?
> 
> I am attaching the .tgz file that demonstrates this problem.
> 
> (See attached file: writetest.tgz)
> 
> Thanks in advance.
> 
> 
> Mark Schapira
> 
> **************************************************************
> *********************************************
> What does meminfo say that the memory is used for?
> It may be a JFFS problem, since ju make a lot of small
> writes to the JFFS there will probably be a lot of small fragments
> written to the flash, and these will have some kind of
> representation in memory as well.
> Garbage collection should eventually merge the fragments
> and reduce the representation as well.
> 
> I will take some time off since I recently became a father to
> a small boy, so I suggest you send a new mail to dev-etrax
> and possibly jffs-dev as well.
> 
> Is this with elinux or Linux 2.4?
> 
> /Johan
> 
> ----- Original Message -----
> From: Mark Schapira <mschapira@xxxxxxx.com>
> To: <johana@xxxxxxx.com>
> Sent: Tuesday, May 15, 2001 6:10 PM
> Subject: Re: memory leaks when writing to a file
> 
> 
> >
> > Hi Johan,
> >
> > In answer to your questions:
> >
> > I am writing the file into the /mnt/flash directory.
> >
> > If I
> > cat /proc/meminfo
> > ./writetest tfile 10000
> > cat /proc/meminfo
> >
> > The 2nd cat /proc/meminfo show that the amount of free memory has
> > significantly decreased.
> >  In fact if I did the following:
> > cat /proc/meminfo
> > ./writetest tfile 10000
> > cat /proc/meminfo
> > ./writetest tfile 10000
> > cat /proc/meminfo
> > ./writetest tfile 10000
> > cat /proc/meminfo
> > ./writetest tfile 10000
> > .......................................
> >
> > I would eventually hang the system so bad that the only way 
> to recover
> > would be to reflash the system.
> >
> > I do not intentionally want to cache the file, I intend for 
> the contents
> > to go to the flash device. The program simply creates n records and
> writes
> > each record to a file.
> >
> > If I mount an nfs directory I do not get this symptom.
> >
> > Please compile and run my test program and I think that you 
> will see that
> I
> > am loosing memory.
> >
> > Thanks in advance.
> >
> > Mark
> >
> >
> >
> >
> >
> > johan.adolfsson@xxxxxxx.com on 05/14/2001 04:43:43 PM
> >
> > Please respond to <johan.adolfsson@xxxxxxx.com>
> >
> > To:   <dev-etrax@xxxxxxx.com>
> > cc:
> > Fax to:
> > Subject:  Re: memory leaks when writing to a file
> >
> > Isn't it just that the file written is cached?
> > Examine /proc/meminfo closer or post it here
> > (version before and after the program is executed)
> > Also, what filename are you using?
> > (are you writing to /tmp/, /etc/  or /mnt/flash/ ?)
> >
> > /Johan
> >
> >
> > ----- Original Message -----
> > From: Mark Schapira <mschapira@xxxxxxx.com>
> > To: <dev-etrax@xxxxxxx.com>
> > Sent: Monday, May 14, 2001 8:24 PM
> > Subject: memory leaks when writing to a file
> >
> >
> > > When I write to a file from a c++ class , I find that memory leaks
> occur.
> > > This is especially true if I make a relatively large 
> number of writes.
> > > When I execute:
> > > cat /proc/meminfo
> > > run the program in question.
> > > cat /proc/meminfo
> > > The second /cat/procmeminfo shows that the amount of 
> memory available
> is
> > > considerably less.
> > > I have run some tests and I have determined that writing 
> to the file
> > causes
> > > the memory leak.
> > >
> > > I am attaching a .tgz file which will illustrate this problem.
> > >
> > > Please let me know why the memory leak occurs.
> > >
> > > Thanks in advance.
> > >
> > > Mark Schapira
> > >
> > >
> > > (See attached file: writetest.tgz)
> >
> 
> 
> 
> 
> 
>