I have written a java code which is a wrapper for combining 3 different softwares. I run the code for 100,000 times normally. At each run, different files should be opened, re-written and closed where all happen in a correct convention of try and catch. If I run the code on a Linux server, there would be no problem. However, when I run it on my mac after 10s of 1000, the Error of Too many open files occur and subsequently error in loading file X and Y and so on and the program terminates.
one more thing I would like to add: the code runs for 1000 times, then the setting gets changed and again for 1000 times and this process repeats. so for the first 4-5 times, there would be no problem, while after 6-7 times (means 6000 runs) this error occurs.