File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes out of memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "out of memory" Watch "out of memory" New topic

out of memory

Howie Jiang

Joined: Aug 25, 2003
Posts: 26
I am processing very big files.. I get out of memory exception when I process every 1000 records in the file.. but processing 100 records is okay. but procesing every 100 records is using longer time than processing every 10 records.. I get two questions here.

1. how can I know the memory will be used out and can do some detection before it throw me an exception?

2. Why my processing every 10 record at a time is faster? how can I get the best performance..

Thanks very much!
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Can you clarify what "processing every 10/100/1000 records" means? As for memory usage, java.lang.Runtime has total/max/freeMemory() methods that you could monitor as you process records.
Joe Ess

Joined: Oct 29, 2001
Posts: 9189

Java Platform Performance will help you gain an understanding of how to measure and compare performance.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: out of memory
It's not a secret anymore!