SAP Memory Management 1708271132
SAP Memory Management 1708271132
While working on SAP systems, we often face memory-related DUMPS in ST22 or see work
processes go in PRIV mode when checked via t-code SM50. You might be wondering why such
things happen in running the SAP system and how to handle it. To understand this, we first
need to understand what SAP memory is and how SAP Memory Management is done. So let’s
get started.
To run an ABAP program within a user session (internal session), the work process allocates
memory, which contains user data (user context), as well as program data. Depending on the
type of data, it is located in different memory areas. SAP Memory Management decides when
and in what order a work process allocates specific memory areas. The order of memory
allocation depends on the work process type (dialog or non-dialog) and on the underlying
operating system
➢ Heap Memory
If we go a little deeper, then we have in total 6 memory areas
• PROC Memory
Local SAP SHM segments can be used by all work processes of one application server instance
(AS instance). Global SAP SHM segments can be used by all work processes of all AS instances
running on the same host
The size of the shared memory pools is defined in the parameter ipc/shm_psize_<xxx>. The
parameter is valid on all operating systems. However, the creation of the pools is heavily
dependent on the operating system.
Extended Segments Memory (ES)
Extended segment memory (ES) forms the basis for extended memory (EM) and global
extended memory (EG). The ES consists of a fimited number of segments located next to each
other and can be accessed by all work processes of an application server instance (AS
instance). An ES segment consists of one or more ES blocks that are all the same size. The size
of the blocks is configured in the profile parameter em/blocksize KB. The default value is 4
MB. When a user context requests a memory area from the EM, one or more blocks are
allocated to the EM from the ES The ES blocks are stored in specific shared memory segments
in the operating system. These segments are exclusively reserved for ES memory. How ES
memory and therefore EM memory are implemented depends on the underlying operating
system.
to independently of the user session. You set the size of the EG in profile parameter
em/global_area_MB
• abap/heap_area_dia
• abap/heap_area_nondia
PROC Memory
PROC memory does not contain any user-specific data, but, like PRIV memory, is specific to the
local process. Unlike the PRIV memory, the PROC memory is used for data that each work
process requires, regardless of the user session, eg. temporary, heap buffer areas. Allocation of
PROC memory does not lead to an exclusive reservation of the process for a specific user
context. With profile parameter em/proc_max size MB, you define the maximum amount of
PROC memory all work processes are allowed to occupy
Once the EM quota is reached, dialog work processes allocate a memory area from the PRIV
memory (HEAP). If the quota for the PRIV memory (abap/heap_area dia) is reached, the
running ABAP program is terminated and an ABAP short dump is created. The consumption
limits of memory (EM or heap) in SAP Memory Management is a protection mechanism in the
ABAP system that is intended to prevent individual user sessions or programs from using up theentire
memory.
If the PRIV memory quota for non-dialog work processes is exceeded, the work. process of this
type allocates a memory area from the EM. If the EM quota (ztta/roll_extension nondia) is
exceeded, the running ABAP program is terminated, and a short dump is wr
Key Memory Parameters
Below is the list of key SAP Memory parameters.
• PHYS MEMSIZE: Specifies the size of the main memory of the host on which AS ABAP
is running
• em/initial size_MB: Specifies the total size of the extended memory (EM). The value
isderived from the size of the physical main memory.
• EM/TOTAL SIZE MB: Controls the total size of the EM for the implementation of
sharedmemory segments (SHM segments).
• em/max size MB: Specifies the maximum size of the dynamically extendable EM
• abap/heap_area_dia: This value specifies how much PRIV memory can be allocated for
auser context by a single dialog work process. The aim is to limit the maximum size of
user contexts so that one single user cannot occupy the entire memory available.
• abap/heaplimit: This value specifies the amount of PRIV memory that, if exceeded,
automatically restarts a work process after completion of the current transaction step. A
bottleneck in the swap space should be prevented by using an automatic restart (as
seldom as possible).
• rdisp/wppriv_max no: The value specifies the maximum number of work processes
thatare allowed to be in PRIV mode.
• rdisp/max priv time: This parameter value specifies the maximum time spent by a
workprocess in PRIV mode.
• ztta/roll_extension: Specifies how much EM can be assigned to a user session (user
context). The EM quota applies both to dialog work processes and to non-dialog work
processes. The current parameter value is the default value for ztta/roll_extension_dia
and ztta/roll_extension nondia. ztta/roll extension only takes effect if its value is lower
than em/initial size MB.
SAP Memory Management - Monitoring
The monitoring tools allow you to monitor your running ABAP system. The following tools are
suitable for monitoring
o To display the memory quotas for the different work process types, choose Goto
-> Current Local Data-> SAP Memory- > Quotas
o You can monitor the memory consumption in the internal sessions of a user. To
do this, choose Goto -> Current Local Data-> SAP Memory -> Mode List. In the
table, you can see how much-extended memory (EM used) and PRIV memory
(HEAP) is being used in the internal sessions of the user on this AS instance.
• Operating System Monitor (ST06) Here you can monitor the swapping of memory
pages and the available swap space in the operating system.
• Report RSMEMORY You can use the report for test purposes.
• Program sappfpar You can use this program to check the configuration of SAP
Memory Management in an AS instance profile via OS level. The program generates a
list. Under swap space requirements estimated you can see the size of the SAP shared
memory (shared memory) of the PRIV memory (processes), and of the extended
memory that is required for this profile. Beneath this you can see the minimum
requirement of swap space (Total, minimum requirement), the maximum worst-case
requirement of PRIV memory (Process local heaps, worst case), and of swap space
(Total, worst case requirements).
• CCMS Monitoring (RZ20) You use the Alert Monitor in the Computing Center
Management System (CCMS) to monitor the entire system, including memory resources
• User Overview (SM04) In the user overview you can see all active users on a specific
application server (AS instance) or across the whole system. Here you can find
information about the consumption of extended segments memory (ES), extended
memory (EM), and PRIV memory.
• Work Process Overview (SM50) In the work process overview (Transaction SM50)
you can see how much memory a single work process consumes, and monitor how
many work processes are running in PRIV mode. This is an indication of an increased
consumption of PRIV memory.
Reference
• help.sap.com
• SAP Notes