0

I am working on calling a main(String[] args) method on quite large datasets and files. The method uses a number parameter files, which it calls using their filenames. However, because of the file size, it takes too long and is not really realistic. Therefore, I have decided to break down the files into small chunks. The simplest idea was to read the main file and write each chunk to a smaller file and call the method a certain number of times. This takes still some time and is not optimal. Therefore, I am curious whether I can simply create an in memory file and call it as a parameter of my method. Is this possible?

Below is a copy of my code. I can create the reference files in preprocessing, but I would specifically like to generate the target file in memory and call it in.

Thanks!

String target = "targetFile.txt";
String ref = "referenceFile.txt";
String output = "outputFile.txt";

String[] imputationArgs = new String[]{ref, target, output};
Main.main(imputationArgs);
Rotavator
  • 123
  • 9

1 Answers1

0

Your java process should be able to hold your file/s in-memory no matter how much parts you've split your input. you can control the memory allocation of your process by passing JVM parameters like java -Xms256m -Xmx2048m

Read this post for more information.

Gal Shaboodi
  • 744
  • 1
  • 7
  • 25