Home > Back-end > Why the Timer timing task runtime memory has been increased
Why the Timer timing task runtime memory has been increased
Time:05-28
Code as shown in figure, a simple single thread monitoring data storage program, the Timer's run () method calls the three methods, the first two methods return, introduced into the third method to send mail, Startup of around 50 m, memory and slow growth, although growth is slow, but sooner or later, overflow, if it is running on the server can't imagine, Please answer ~
CodePudding user response:
Code not whole, through the analysis of the description, may be a more and more data in a collection objects, not cleaning mechanism, memory is slow growth probability is that In view of the public list code, set, map, etc., if the data is to add, need to have regular cleaning mechanism or backup mechanism, such as more than how much, brush all the data to the database or redis or file, and then clean off the original collection
CodePudding user response:
You see that no one can help you
CodePudding user response:
Use jprofile look at heap, and see which objects are not gc