-
Hi i have a question, how to solve it. I have a list of files (ca. 10000 files) and i'll try to create the same numbers of manifests from
I use Linux and i settings it is possible to use up to 65000 files. Do you have any idea how |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi, can you give me a little more info... are you using Manifestor's readManifest(File) or readManifest(File, Promise) or are you reading CSV files or something and creating the manifests from them? Can you provide some test code showing me how you're looping over all the files? Are you writing to JSON output files as you read them? Would you also show me the output of |
Beta Was this translation helpful? Give feedback.
-
Looking at the above example I'd say it's because you're opening a file stream at As a test, I used the following Bash script to create 5000 test JSON files:
Then I use the following code to read and write them:
It works. Yours is a little different because you're using a different JSON processing library but, unless that JSONObject is somehow closing that FileInputStream in code we can't see in the example, I'd bet that's it. You need to put that input stream into a variable and close it at the bottom of the for loop (before that exits -- or use a try-with-resources syntax). Also, you should move the Manifestor constructor outside the for loop. With it inside, it's creating a new instance each time the loop circles. It only needs to be created once, and then its read/write methods called against that single instance. Hope that helps! |
Beta Was this translation helpful? Give feedback.
Looking at the above example I'd say it's because you're opening a file stream at
new FileInputStream(file)
(inside the loop) but never closing it, so running out of file handles.As a test, I used the following Bash script to create 5000 test JSON files:
Then I use the following code to read and write them: