public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] JFFS2 eats memory
@ 2004-07-12 14:42 Øyvind Harboe
  2004-07-13  7:40 ` Andrew Lunn
  2004-07-13  9:30 ` David Woodhouse
  0 siblings, 2 replies; 29+ messages in thread
From: Øyvind Harboe @ 2004-07-12 14:42 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

This issue has been discussed before, and although I have a workaround,
I'd dearly like to have it put to bed since it is starting to cause
problems elsewhere in my application:

- My code opens a file for writing with O_TRUNC set, performs
a single write call, closes the file.
- After closing the file, JFFS2 has eaten memory.
- With the attached modifcations to JFFS2, it "only" eats 24 bytes.
- If I unmount and remount JFFS2, no memory is "lost" and JFFS2 works
fine.

Presumably when the raw nodes in the file fragement list are marked as
obsolete, they are no longer required, but are not freed.

Q: Is this fundamentally impossible or a "bad idea" to fix?


-- 
Øyvind Harboe
http://www.zylin.com


[-- Attachment #2: jffsmemfix.txt --]
[-- Type: text/x-patch, Size: 1184 bytes --]

Index: src/fs-ecos.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
retrieving revision 1.27
diff -u -w -r1.27 fs-ecos.c
--- src/fs-ecos.c	21 Apr 2004 18:51:21 -0000	1.27
+++ src/fs-ecos.c	12 Jul 2004 14:25:41 -0000
@@ -199,7 +199,9 @@
 	// held where needed for dotdot filepaths)
 	while (this) {
 		next = this->i_cache_next;
-		if (this != i && this->i_count == 0) {
+		if (
+		    //this != i && 
+		    this->i_count == 0) {
 			struct _inode *parent = this->i_parent;
 			if (this->i_cache_next)
 				this->i_cache_next->i_cache_prev = this->i_cache_prev;
@@ -1466,12 +1468,22 @@
 {
 	struct _inode *node = (struct _inode *) fp->f_data;
 
+	// cache values before we destroy the node
+	struct jffs2_sb_info *c = JFFS2_SB_INFO(node->i_sb);
+	struct _inode *root = node->i_sb->s_root;
+
 	D2(printf("jffs2_fo_close\n"));
 
 	jffs2_iput(node);
 
 	fp->f_data = 0;		// zero data pointer
 
+
+	// free as much of cached structures as possible to make sure
+	// that memory usage stays stable and that idle memory usage
+	// is at a minimum.
+	icache_evict(root, node);	
+
 	return ENOERR;
 }
 


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 29+ messages in thread
* [ECOS] JFFS2 eats memory
@ 2008-04-08 15:28 Jürgen Lambrecht
  0 siblings, 0 replies; 29+ messages in thread
From: Jürgen Lambrecht @ 2008-04-08 15:28 UTC (permalink / raw)
  To: oyvind.harboe, dwmw2; +Cc: linux-mtd, eCos Discussion

Hello Oyvind and David,

in 2004, you talked about "JFFS2 eats memory". But the thread was 
stopped when David went to "OLS".
I have the same problem now, see my last mail about: JFFS2 "eats RAM" 
per file in flash.
Did you continue on this?
Or should I look to jffs3 or ubifs?

Kind regards,

-- 
Jürgen Lambrecht
R&D Engineer
Televic Transport Systems
http://www.televic.com
Televic NV / SA (main office)  	
Leo Bekaertlaan 1
B-8870 Izegem
Tel: +32 (0)51 303045
Fax: +32 (0)51 310670


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2008-04-08 15:17 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-12 14:42 [ECOS] JFFS2 eats memory Øyvind Harboe
2004-07-13  7:40 ` Andrew Lunn
2004-07-13  7:53   ` Andrew Lunn
2004-07-13  8:09     ` Øyvind Harboe
2004-07-13  8:31     ` Øyvind Harboe
2004-07-13  7:58   ` Øyvind Harboe
2004-07-13  9:30 ` David Woodhouse
2004-07-13  9:49   ` Øyvind Harboe
2004-07-13 10:05     ` David Woodhouse
2004-07-13 10:39       ` Øyvind Harboe
2004-07-13 13:41       ` Øyvind Harboe
2004-07-13 23:01         ` [ECOS] " David Woodhouse
2004-07-14  8:15           ` Øyvind Harboe
2004-07-19 14:25             ` Øyvind Harboe
2004-07-19 15:15               ` David Woodhouse
2004-07-19 16:32                 ` Øyvind Harboe
2004-07-20  6:42                   ` David Woodhouse
2004-07-20  7:51                     ` Øyvind Harboe
2004-07-20 14:25                       ` David Woodhouse
2004-07-20 15:51                         ` Øyvind Harboe
2004-07-20 16:08                           ` David Woodhouse
2004-07-20 20:29                             ` Øyvind Harboe
2004-07-21  2:28                               ` David Woodhouse
2004-07-21  7:54                                 ` Øyvind Harboe
     [not found]                                   ` <1090410703.4280.10.camel@localhost.localdomain>
2004-07-21 12:50                                     ` Øyvind Harboe
2004-07-21 16:33                                       ` David Woodhouse
2004-07-20 13:46                     ` Øyvind Harboe
2004-07-13 10:08     ` [ECOS] " Thomas Koeller
2008-04-08 15:28 Jürgen Lambrecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).