• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

File size and Performance

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic