Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
10,421

The amount of memory an ABAP program consumes depends on the amount of data being processed, which is typically stored in some type of in-memory structure (such as internal tables) that grows dynamically to accommodate the stored data. If the amount of stored data to be loaded into system memory exceeds the size of available storage area, the program terminates, possibly with the runtime errors such as SYSTEM_NO_ROLL or TSV_TNEW_PAGE_ALLOC_FAILED.

  Because these errors can arise for a variety of reasons, the root cause may not be immediately obvious .For example, the runtime error TSV_TNEW_PAGE_ALLOC_FAILED occurs when the system can’t increase the size of an internal table due to insufficient available memory. However, this internal table might not be the reason why memory is exhausted. What you need in this situation is a tool to help you determine the real reason that the application has run out of memory.

The ABAP Memory Inspector provides you with an overview of dynamically allocated data (that is, all dynamic in-memory structures) at a particular time, which can be very helpful for diagnosing memory consumption problems, as well as a specialized transaction for analyzing this data.

Using the ABAP Memory Inspector

Analyzing the memory consumption of an application typically consists of two types of scenarios:

  • You’re interested in the current memory consumption of a running program in order to check if it is unexpectedly high.
  • You want to compare the memory consumption of a program at different times in order to find out if it increases in an undesirable way and to identify which memory objects contribute to the increase.

Creating the Memory snapshots

There are several ways to create a memory snapshot:

  • When debugging an application, select Development->Memory analysis->Create Memory snapshots from the ABAP debugger menu bar .A completion message indicates when the file is ready.
  • Enter the command /hmusa in the command field on any SAPGUI screen –you don’t need to be in the debugger .When the file is ready, you will see the same completion message shown for the previous option.

Analyzing and Comparing Memory Snapshots

The ABAP Memory Inspector provides a dedicated transaction for displaying the content of stored memory snapshots.

You start this transaction via S_MEMORY_INSPECTOR, or Memory analysis ->Compare Memory snapshots from the menu bar.

For Example:

Lets say you want to analyze the memory consumption of some program (demo program : ZTEST_MEMORY)

Run the report ZTEST_INDEX


You will get the output as below.


Now enter /hmusa in the command field.


Message will be displayed at the bottom indicating that memory snapshot is created.


To the view the memory snapshot go to the transaction S_MEMORY_INSPECTOR.

Double-click on an entry in the list to open a screenshot and display its contents in the lower part of the screen. You can have up to two snapshots open at one time. Opening a third snapshot automatically closes one of the others based on the difference in creation time. The first opened snapshot is referred to as (t_0);second as (t_1) .To select an open snapshot for display ,use the (t_0) and (t_1) buttons in the application at the top of the screen, or use the Memory Snapshot dropdown list located above the display tree in the lower part of screen.

4 Comments
Labels in this area