SAP Memory Concepts

Roll Memory –>The roll area holds the user environment information needed by work processes when executing dialog steps.

Extended Memory –> Specifies how much of the SAP extended memory was requested by this user.

Heap memory–> Private memory (heap memory) requested by the user.

Swap Memory –> SAP swap area is only used for a limited number of ABAP commands.


Roll Memory:

The roll area is a memory area with a set (configurable) size that belongs to a work process. It is located in the heap of the virtual address space of the work process.

When the context of a work process changes, the data is copied from the roll area to a common resource called the roll file. To prevent repeated copying, another roll buffer is located in between that is part of the shared memory.

The roll area consists of 2 segments. The first segment, which can be set with the parameter ztta/roll_first, is assigned to the work process first as memory. If this is used up, the work process has more memory assigned to it. The amount of memory is determined by the difference between the parameters ztta/roll_area and ztta/roll_first.

NOTE- Sequential memory allocation to several work processes using a relatively slow copying process
Extended Memory:

SAP extended memory is the core of the SAP memory management system. Each SAP work process has a part reserved in its virtual address space for extended memory. You can set the size of extended memory using the profile parameter em/initial_size_MB: Extended Memory Pool Size.

You can map the extended memory from the common resource onto any work process, and after onto another process on the same address in the virtual address space. This is important if you work with pointers in the ABAP program.

Heap Memory:

Other processes cannot use private (heap) memory. After releasing the assigned memory, the operating system still considers the (virtual) memory as being occupied by the allocating process. These characteristics of heap memory require that:

The work process can be run in PRIV mode (private) when the local memory is assigned. This means that the work process is reserved for processing the current user context until the context releases the work process again when the request has ended.

The work process, if it has used a lot of private memory, is restarted when the user context is terminated and the local memory is returned. The restart makes the local memory available again for other processes. A restart occurs if a work process uses more local memory than is defined in the parameter abap/heaplimit.

If a dialog work process has used up the roll area assigned to it and the extended memory, private memory is assigned to the work process. The work process goes into PRIV mode (private).

In the parameter settings, ensure that not too many dialog work processes are simultaneously in the PRIV mode, since this lowers system performance.

The other Work Process types (background, update, enqueue and spool work processes) are assigned heap memory after the roll area is used up. Allocating Extended Memory is not useful since no context change occurs for these processes.

SAP Swap memory

Allocation of memory for the current internal session by transferring pages out of memory, similarly to operating system paging.

SAP Paging enables the roll area to be extended at ABAP runtime when a large dataset, internal tables, for example, is handled.

SAP’s memory management concept currently limits SAP Paging to cases where the ABAP commands EXTRACT and EXPORT… TO MEMORY… are used.

SAP Memory Allocation Sequence in Dialog Mode

Based on above diagram will explain how the sequencing works

  1. At first Roll area is used and the assigned memory is based on SAP parameter “ztta/roll_first”, as per the above diagram user will be assigned with 20KB memory and when it fills it uses extended memory
  1. post roll area 1 user uses the extended memory and its value is based on SAP parameter “em/initial_size_MB” and user quota for particular work process is depending upon SAP parameter ztta/roll_extension_dia. If this memory is not sufficient then
  1. Remaining Roll area is used and memory is depending upon “ztta/roll_area- ztta/roll_first” if this memory is not sufficient then
  1. The system uses local heap memory [private memory]. Then the work process goes into PRIV mode and below possibilities can arises
    1. 5.Limit of heap area of workprocess reaches and value is based on SAP parameter “abap/heap_area_dia “ or the entire heap memory of all the work processes bases of SAP parameter “abap/heap_area_total” for an application server reaches its limit which degrades SAP system performance

6.Operating system limit of allocation of memory.
7.The swap space in the host system is used up or the upper limit of the OS address space is reached.

Once work process comes in PRIV mode it  cannot be terminated by the parameter “rdisp/max_wprun_time”, it remains connected to the user until the user ends the transactions or it is timed out by the system due to the memory or explicitly logged out using SM04/DPMON.

SAP Memory Allocation Sequence in Background Mode

1) At first Roll Area is used and its value is based on SAP parameter “ztta/roll_area”,

If roll area is full then.

2) Heap area is used and it will be available until following occurs.

a) Either limit of heap memory is used based on the SAP parameter “abap/heap_area_nondia” or it uses entire heap memory assigned for all the workprocess and its value based on SAP parameter “abap/heap_area_total”

b) Operating system limits of allocating memory

c) The swap space in the host system is completely used up. However, this situation should not occur often which results in severe performance issues. Please check swap space requirements for various platforms and define swap space optimally to avoid this issue

3) If the heap memory is full then it uses extended memory and its value based on SAP parameter “em/initial_size_MB”.

2 thoughts on “SAP Memory Concepts

Leave a Reply

Your email address will not be published. Required fields are marked *