Java program is getting slower after running for a while

前端 未结 7 1369
天涯浪人
天涯浪人 2021-02-04 03:20

I have a java program that is a typical machine learning algorithm, updating the values for some parameters by some equations:

for (int iter=0; iter<1000; ite         


        
7条回答
  •  有刺的猬
    2021-02-04 03:56

    I'm sorry to post this as an answer but I don't have enough score to comment.

    If you think it's a GC related issue I'd change it for the Garbage 1 Collector –XX:+UseG1GC

    I found this brief explanation about it: http://blog.takipi.com/garbage-collectors-serial-vs-parallel-vs-cms-vs-the-g1-and-whats-new-in-java-8/

    Can you run your software under profiling? Try to use the jprofiler, VisualVM or even the netbeans profiler. It may help you a lot.

    I noticed that you have your own encapsulation of a vector and matrix. Maybe your are spending a lot more memory than necessary with that too. But I don't think that is the problem.

    Sorry again about not contributing as a comment. (It would be more appropriate)

提交回复
热议问题