huge recursive and memory leaking?

J

jojo

hi,

I have a program which loads the whole file system and write to the
corresponding database tables. I'm using a recursive to traverse the
file system and do the database mapping. but very time, the program
stopped randomly without exception returned. I wonder is that because
of the memory leaking? does JAVA return memory leaking exception?
thanks.
 
A

Andrew Thompson

I have a program

SSCCE? said:
..which loads the whole file system

Do you mean the directory and file *names*, or 'the files'
on the filesystem?
...and write to the
corresponding database tables. I'm using a recursive to traverse the
file system and do the database mapping.

Are you retaining refrences to what you have already written?
..but very time, the program stopped randomly

If it is 'every time', that sounds 'pretty reliable',
rather than 'randomly'.

As to exactly where the program bombs, do you do
output of where you are up to?
..without exception returned.

Some 'Exceptions' are *Error*s.
..I wonder is that because of the memory leaking?

Well, I wouldn't go blaming the dog for this one.
..does JAVA return memory leaking exception?

OutOfMemoryError, you need to ..

try {
// do big stuff...
} catch(OutOfMemoryError oome) {
// choices are very limited here, but
// you can usually do a few ticks to
// gain enough memory to warn the user
// the program is about to crash.
}
....

HTH
 
J

jojo

thanks for your reply. I use File in Java to do the recursive and
mapping the corresponding information to my database. ' stop randomly'
means it stops at uncertain point. sometimes the records in database
are add up to more than 50,000 and sometimes only more than 10,000.
 
J

jojo

B.T.W i 'm running the program within TOMCAT, is that the cause to it?
or i'd better run such huge stuff out of these AS. thanks
 
R

Roedy Green

thanks for your reply. I use File in Java to do the recursive and
mapping the corresponding information to my database. ' stop randomly'
means it stops at uncertain point. sometimes the records in database
are add up to more than 50,000 and sometimes only more than 10,000.

do you by any change go into an infinite loop waiting for a locked
file?
 
J

jan V

jojo said:
B.T.W i 'm running the program within TOMCAT, is that the cause to it?
or i'd better run such huge stuff out of these AS. thanks

If you use a sensible development methodology, then you would already have a
way to test that particular aspect of your program without having to start
Tomcat. As you're finding out now, being able to test things independently
from the bulk of a system's complexity can help you when debugging things...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top