STAX doesn't free the memory after the jobs are finished.
We executed some tests using simple and looping STAX script which starts the staf command "staf local delay delay 20s". More details you will find in the following:
===========================================================================
Simple STAX script | No | No | Memory usage cap: 600 MB - All tests finished: 400 MB
Looping STAX Script | No | Yes | Memory usage cap: 925 MB - All tests finished: 830 MB
Script only started a staf command ("staf local delay delay 20s")
Started ~500 jobs for each test after STAF restart.
Memory usage at start ~80 MB
Looping = Infinite loop
- Stopped with "TERMINATE" request once all tests are started (staf local stax terminate job <id>)
I need that STAX free the memory because if you have a lot of jobs the memory of the system increase to much and never decrease and finally the system will crash.
Hello, Can you please give me a state about this ticket?
I haven't been able to find a memory leak in STAX for the issue you described.
We don't have any real control over Java's garbage collector, so Java may not decide to garbage collect for a long time, leaving you with a lot of memory in use.
Java garbage collector investigation:
It seems that after the jobs end, heap size for the application return to it's original value (~200MB) but the memory usage shown in Task Manager remains the same. During the investigation I found out that the rest of the memory (~1GB) which remains allocated for stax application is part of native memory.
Doing a comparison between the basline for the native memory before starting the test and the one after the tests runs show that the committed memory is still increasing even is the heap memory used decreases.
Attached you can find a file with the comparison of native memory baseline and after tests.
For testing above scenarions Java v1.8_162 and Stax v3.5.15 were used.
Links used in investigation:
https://stackoverflow.com/questions/35539283/javas-ram-usage-doesnt-correspond-to-what-the-task-manager-says?answertab=oldest#tab-top
http://www.oracle.com/webfolder/technetwork/tutorials/obe/java/gc01/index.html#RequiredSoftware
http://karunsubramanian.com/uncategorized/why-is-there-a-discrepancy-between-windows-task-manager-memory-and-java-heap/
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html
Hello,
Could you please inform me if there is any new information/state of this ticket?
Thank you in advance!