This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

JFFS2 "eating memory" when creating files


As near as I can tell, JFFS2 "eats memory" because it caches various
information.image.

We are using JFFS2 intermittantly. Inbetween these JFFS2 sessions, we
would like JFFS2 to free up any memory that it allocated.
In this context, RAM is "costly" and CPU to rebuild any cached
information during the next JFFS2 session is "free".

My preferred behaviour would be if JFFS2 freed up all caches once all
files where closed(the least amount of code impact), but if there is no
way to modify JFFS2 to do this, I plan to mount/unmount before/after the
JFFS2 session.

After making the attached changes to fs-ecos.c, things are looking much
better, but JFFS2 still "eats" 24 bytes every time I open, write and
close a file.


Free RAM measurement:

	struct mallinfo info;
	info = mallinfo();
	printf("Available ram %d\n", info.fordblks);



Øyvind

Index: ecos/packages/fs/jffs2/current/src/fs-ecos.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/fs-ecos.c,v
retrieving revision 1.19
diff -a -w -u -r1.19 fs-ecos.c
--- ecos/packages/fs/jffs2/current/src/fs-ecos.c	9 Mar 2004 08:12:08 -0000	1.19
+++ ecos/packages/fs/jffs2/current/src/fs-ecos.c	10 Mar 2004 13:13:53 -0000
@@ -1464,6 +1464,10 @@
 
 	fp->f_data = 0;		// zero data pointer
 
+	// flush all cached entries
+	struct _inode *root = (struct _inode *) fp->f_mte->root;
+	icache_evict(root, NULL);
+
 	return ENOERR;
 }
 
@@ -1802,7 +1806,7 @@
 	} else {
 		// Evict some _other_ inode with i_count zero, leaving
 		// this latest one in the cache for a while 
-		icache_evict(i->i_sb->s_root, i);
+		icache_evict(i->i_sb->s_root, NULL);
 	}
 }
 

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]