Saturday, August 11, 2007

Memory allocation strategy for work processes

All of you That familiar with the SAP Memory management and
red this section from SAP Documentation knows that the memory allocation process for the User context is different between the Dialog and other work process.

The memory allocation composed from different memory types which are:roll area,extended memory and Heap Memory.

The allocation sequence for The Dialog is:
1. first part of the roll area which defined according to the profile parameter ztta/roll_first
2. Next is the extended memory
3.The rest of roll area according to the profile parameter ztta/roll_area.
4.Heap memory.

The allocation sequence for Other types of work process:
1.all the roll area
2.Heap Memory
3.extended memory.

(The Reason why this difference make sense will be covered in my next post).

Until a year a go, i assumed that, this allocation strategies are the default behavior in every SAP system, and of course it's was wrong!.

By default, the allocation sequence is the same for all the work process. you can check the allocation strategy by going to transaction st02
pressing on the "Detail Analysis Menu" followed by "SAP Memory" and finally the "Quotas" button.
There is Two tables , "Dialog tasks" and "non-dialog tasks" and as you can see the sequence is the SAME.
To change this behavior you need to perform the following steps:

1. From SE38 run the Report "rsmemory"
2. There is two tables:



















Next to each step you can choose which type of memory will be allocated (the "memory class" column)
1. 0 (or empty) - ROLL
2. 1 - Extended memory
3. 2 - HEAP.

On the Second table perform as follows:
1. In step 1 leave the type field empty
2. In the size area put the value of the ztta/roll_area parameter.
3. In step 2 change the "memory class" to 2(HEAP)
4. Write the value of the abap/heap_area_nondialog parameter in the size column.
5. In step 3 write 1 and the the value of the em/initial_size_MB parameter in the size column.
6. Delete the rest.
7. Press the copy button.
8. Check the allocation strategy in the "Quotas" screen that I mentioned before.

Warning!!!: All the Changes will be reset after the restart of the system.