Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use S_MEMORY_INSPECTOR to analyze memory leak

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to use S_MEMORY_INSPECTOR to analyze memory leakage problems, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problems and solutions, through this article I hope you can solve this problem.

When I was generating service order in batches, report ran for a few hours and encountered out of memory exception:

I found in SM04 that my report consumes more and more memory over time:

How do I find the exact location of the code where the memory leak appears?

There is a package size in my report, which is similar to OPEN CURSOR and FETCH's design. For example, if package size is 1000, then after every 1000 service order is created, clear the buffer, then create the second batch of 1000 order, and then clear the second buffer.

So I just need to create a memory snapshot after clearing the buffer twice:

After creating the tcode S_MEMORY_INSPECTOR, compare the delta part of the two snapshot, that is, the variable that causes the memory leak. This transaction lists the program name where the variables are located, and all that's left is to find the API that clears the variables.

After the modification, the results are remarkable. Before the modification, a user session ran for an hour and the memory consumtpion exceeded the 7GB. Now, after running all afternoon, each session does not exceed the 2GB.

After reading the above, have you mastered how to use S_MEMORY_INSPECTOR to analyze memory leaks? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report