• Post Reply Bookmark Topic Watch Topic
  • New Topic

File size and Performance

 
Collin Goredema
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I am writing to a file in Java, does the size of the file take space from the allocated memory heap? How would a 129mb file affect performance?
 
Viswanathan Nachiappan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess the file takes the space from RAM and not the HEAP. Hence we can work with large files (i.e. the RAM is capable of...)

Please Advise.
viswa
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15711
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on your program.

Just opening a file (by creating a FileInputStream for example) does not take up a huge amount of memory and the memory usage is not dependent on how large the file is.

If you write a program that loads the whole contents of the file into memory, then yes, your program will need a lot of memory. But then it's your own code that's doing it, not the code in the standard Java library.
 
Viswanathan Nachiappan
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String command = "script.bat";
Process p = Runtime.getRuntime().exec(command);
InputStreamReader isr = new InputStreamReader(p.getInputStream());

I get an InputStream form the above Process, Does anyone knows where this InputStream is stored ( RAM / HEAP )???

Thanks in Advance,
viswa
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Viswanathan, your post has been answered more than once. If you are still confused, why don't you follow up one of those other posts rather than starting new conversations?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!