Reputation: 51
We have created the custom test-sutomation framework for our project. This mimics the interaction (mainly json two way data flow in GET and POST request) between browser and server using HTTP client.
Here is hot it happens, We have some 1000 test cases automated. Test case execution involves creation of tonnes of messages and hence tonnes of strings; reading large files repeatedly and verifying the contents and off-course throwing everything after getting verification result. It goes for all the test cases, takes anywhere between 15 to 20 hours.
The problem is that, we are stuck with OutOfMemory Error. Any Idea?; on cleaning up the memory which is consumed after reading and parsing from large files 100MB - 250MB. There are lot of splits, replace, substring operations going on.
Please, Can anybody provide tips,suggestions?
-Thanks in advance
Upvotes: 3
Views: 18913
Reputation: 587
You can explicitly make the objects to null.
Even you can call System.gc();
Upvotes: 0
Reputation: 5213
In general, you should make sure you maximize the objects available for garbage collection. One way to do this is declaring variables in the narrowest possible scope. (Eg: inside a try block, use method local variables)
You may also have to increase Java heap size.
Upvotes: 1