out of memory & high CPU consumption on reading in files
hi experts,
i've designed a search runnable class.
it searches for particular (matched) items in RSS(XML) documents stored on local drive, let say just 2000 files.
the matched items then appended in JTable.
i've 2 problems right now.
1. sometimes my application gives "out of memory" exception during all above process, normally it happened after 500 or 600 files read.
2. while searching more than 90% CPU consumed.
i want to handle "out of memory" exception and make it smooth search application, that during search operation user may do its other work concurrently and smoothly.
for xml file parser, i've used JDOM, after i get the relevant items, i make null all objects which i don't have further need.
but it seems that while adding in JTable , all memory is occuppied by JTable, because i've tested my app, by commenting the code which adds new rows to JTable, then i don't get "out of memory" error.
please help me
regards
[1010 byte] By [
naeemga] at [2007-11-27 10:56:49]

all data already in their respective files.
i'm making search program for those files.
and search results are appended in JTable for user as list.
e.g.
search in file 1.xml.
5 items found
items appended to JTable.
search next file
2 items found
items appended to JTable
total items now 7 in JTable.
the process goes on untill whole directory of those files searched.
this is requirment to save all data in JTable at once.
it should not be problematic for JTable, as far as i've tested with only 3000 rows, sometimes less sometimes greater.
i read about Xms command,
i used as its described at
http://www.jguru.com/faq/view.jsp?EID=424214
but java gave error of invalid arguments.
if by increasing memory my problem can be solved, then how to programmatically increase it, i've searched too much on web, but failed to find any solution.
If you need to mess with -Xmx you are doing something wrong in my opinionl.
Are you closing every file?
Are you reading the entire file into memory?
Are you releasing the data you read from the file when you've searched it?
Or are you just hoping that all the files will fit into memory at the same time? Never assume that. Never assume that even one file will fit into memory.
ejpa at 2007-7-29 12:05:14 >
