培训者:SAP成都研究院开发人员Jerry Wang

1. Understanding Memory Objects in ABAP

Note1: DATA itab WITH HEADER LINE for processing individual table rows have short forms that implicitly use the header line as work area. These short forms are allowed only outside of ABAP Objects.

/SF0A0001/ANONYMOUS

495142

2. Use Reference to Access Memory Object

ABAP里引用的用法

3. ABAP和很多其他语言一样,支持写时拷贝:

As internal tables and strings can become very large, the copy operation may be quite time-consuming. On the other hand, the copy operation is only necessary if a modification is made via one of the references, which is NOT always the case.

For this reason, ABAP runtime delays the copy operation until a modification is actually made. These object types (internal tables and strings) keep track of the number of references that point to them, which is referred to as “reference counting.”

4. 写时拷贝的工作原理

5. ABAP的内存管理之内存清理

内存释放关键字CLEAR,REFRESH和FREE的区别:

6. ABAP引用类型的内存分配

7. ABAP字符串(String)类型的内存分配

8. ABAP内存垃圾回收器的工作原理

9. ABAP内存垃圾回收的实现算法

10. ABAP垃圾回收机制的触发时机

11. ABAP垃圾回收的手动触发,请谨慎使用

12. 更多关于引用类型的变量在ABAP垃圾回收算法中的影响

13. ABAP bound memory的含义

the sum of the size of the memory object and the bound memory of all DIRECT children that are table bodies or strings with a reference count of one.

Upon deleting the memory object, the bound memory is the minimum amount of memory that is released, and the referenced memory is the maximum amount that can be released. Therefore, the amount of memory that is actually released is somewhere between these two values.

14. ABAP内存预分配算法(preallocation mechanism)介绍

15. ABAP已分配内存和已使用内存的区别

For internal tables and strings, ABAP runtime environment uses a preallocation mechanism that automatically reserves some EXTRA storage when the memory object is created to allow for potential growth.

It avoids many allocation and deallocation operations. Otherwise, ABAP runtime environment would have to allocate new storage every time the memory object grows.

Due to this preallocation mechanism, both internal tables and strings also have “allocated memory” and “used memory” values as memory sizes.

Allocated memory is the amount of memory that is set aside for the memory object. Used memory is the current size of the memory object used by the application.

For class objects and anonymous data objects, used memory and allocated memory are the same. Because their size is fixed, they don’t require additional space to accommodate growth.

16. ABAP程序内存消耗的尺寸计算介绍

17. 什么是ABAP内存分配中的SCC - strongly connected component - 强连通组件

18. 有用的ABAP内存分析和调优工具,事务码S_MEMORY_INSPECTOR

19. 具体例子,您知道下面这段代码,新生成的引用类型的变量,内存是从哪里分配的?堆?不完全对。

Logging on to an application server opens a user session. A user session is assigned its own memory area of the SAP memory, in which SPA/GPA parameters can be stored.

For every user session , a main session ( external session ) can be opened. Each main session is assigned its own memory area of ABAP memory ( EXPORT --- IMPORT ) rdisp/max_alt_modes

Each call of an ABAP program creates a new internal session, in which the called program is loaded.

20. 什么是ABAP程序的PXA - Program Execution Area

21. ABAP程序的用户上下文 - User Context

22. 什么是ABAP的工作进程

23. ABAP工作进程的内存虚拟地址空间和物理地址空间的映射

Roll Area:

Memory area with a set (configurable) size that belongs to a work process.

For technical reasons, the roll area is always the first memory available to use for a work process. Only afterwards can extended memory be requested.

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

Paging area:

Allocation of memory for the current internal session by transferring pages out of memory, similarly to operating system paging. SAP's memory management concept currently limits SAP Paging to cases where the ABAP commands EXTRACT and EXPORT... TO MEMORY... are used.

Private memory:

If the extended memory is fully occupied, or the limit for the work process has been exceeded, private memory is assigned to the work process. This is known as private memory because it is specific to the process, and the user context can no longer be processed by a different work process (PRIV mode).

ABAP扩展内存 - extended memory

User context is stored in the extended memory (EM) to enable fast context change . Depending on the operating system, how SAP implements EM addressing/mapping is different.

When the context is changed, the user context is not copied as with the roll area. Instead it is allocated to alternating work processes by mapping operations which results in a faster context change because less data is copied and mapping an extended area is not work-intensive. The result is low CPU usage and shorter access times.

SAP dispatcher is responsible for the following principle tasks:

1. Initialization, reading profile parameters, starting work processes and logging on to the message server

2. Evenly distributing the transaction load across work processes

3. Connecting to the GUI layer

4. Organizing communication processes

这道题的答案:

The roll area consists of two 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 ztta/roll_area and ztta/roll_first parameters.

正确答案,不能一概而论,有三种情况。

情况1:

Roll area: if ( roll_current_area + request size <= roll_area )

情况2:

Extended memory: if ( roll_current_area + request size > roll_area ) AND ( extend memory is not full )

情况3:

Private memory: if ( roll_current_area + request size > roll_area ) AND ( extend memory is full )

要获取更多Jerry的原创文章,请关注公众号"汪子熙":

SAP专家培训之Netweaver ABAP内存管理和内存调优最佳实践的更多相关文章

  1. JVM | 第1部分:自动内存管理与性能调优《深入理解 Java 虚拟机》

    目录 前言 1. 自动内存管理 1.1 JVM运行时数据区 1.2 Java 内存结构 1.3 HotSpot 虚拟机创建对象 1.4 HotSpot 虚拟机的对象内存布局 1.5 访问对象 2. 垃 ...

  2. JVM的内存结构以及性能调优

    JVM的内存结构以及性能调优 发布时间: 2017-11-22 阅读数: 16675 JVM的内存结构以及性能调优1:JVM的结构主要包括三部分,堆,栈,非堆内存(方法区,驻留字符串)堆上面存储的是引 ...

  3. 【Bugly干货分享】iOS内存管理:从MRC到ARC实践

    Bugly 技术干货系列内容主要涉及移动开发方向,是由Bugly邀请腾讯内部各位技术大咖,通过日常工作经验的总结以及感悟撰写而成,内容均属原创,转载请标明出处. 对于iOS程序员来说,内存管理是入门的 ...

  4. davlik虚拟机内存管理之一——内存分配

    转载自http://www.miui.com/thread-74715-1-1.html dalvik虚拟机是Google在Android平台上的Java虚拟机的实现,内存管理是dalvik虚拟机中的 ...

  5. Delphi的内存管理及内存泄露问题 FastMM4

    这几天因为一个程序长时间运行出现比较严重的内存泄露问题,开始关注了一下内存管理方面的东西,以前也注意内存管理,创建了对象及时释放,但总有忘了处理的情况. 在Delphi中没有自动回收机制,所以一定要及 ...

  6. window内存管理与内存原理

    转自: http://blog.csdn.net/iamfranter/article/details/6826270 WIndows为每个进程分配了4GB的虚拟地址空间,让每个进程都认为自己拥有4G ...

  7. Objective-C 【内存管理&手动内存管理 综述】

    ------------------------------------------- 内存管理 (1)Objective-C的内存管理 栈区    存放局部变量(由于基本数据类型占用的存储空间是固定 ...

  8. Android 之 内存管理-查看内存泄露(三)

    概述 在android的开发中,要时刻主要内存的分配和垃圾回收,因为系统为每一个dalvik虚拟机分配的内存是有限的,在google的G1中,分配的最大堆大小只有16M,后来的机器一般都为24M,实在 ...

  9. Java的内存管理与内存泄露

    作为Internet最流行的编程语言之一,Java现正非常流行.我们的网络应用程序就主要采用Java语言开发,大体上分为客户端.服务器和数据库三个层次.在进入测试过程中,我们发现有一个程序模块系统内存 ...

随机推荐

  1. Git 学习之关于版本库

    记得在第一次接触代码的时候,当对一些改动不是很确定的时候,我的做法就是在我的电脑上保留多个文件,分别以不同的名字来保存,以便于以后发现某个地方的带动是错误的好做修改,现在想想真是好笑啊. 慢慢的在工作 ...

  2. Jedis连接redis

    今天与大家分享下,Jedis连接池使用.先看一段JAVA 代码:         JedisPoolConfig config = new JedisPoolConfig();         con ...

  3. 【c++】iostreeam中的类为何不可以直接定义一个无参对象呢

    缘起 #include <iostream> #include <fstream> #include <sstream> using namespace std; ...

  4. Centos 从零开始 (三)

    8:连接阿里云. 需要用到 ssh指令进行远程登陆 [root@localhost ~]# service sshd start #如果没开启服务的话,需要开启服务. [root@localhost  ...

  5. ajax返回整个页面

       

  6. 快速删除node_modules目录

    当node项目需要重新安装依赖,并且需要删除原有的node_modules目录时,windows下删除该目录比较麻烦的,所以我就在网上找了个npm包,名字叫做 rimraf 安装步骤: npm ins ...

  7. JS判断浏览器类型,JS判断客户端操作系统

    JS判断浏览器类型 function judge(){ var browser = { versions: function() { var u = navigator.userAgent, app ...

  8. Postman安装及入门实践(以百度搜索为例)

    一.Postman安装 可以FQ的小伙伴可以直接去官网下载:https://www.getpostman.com 如果不能,可以用我的安装包,版本找最新的:链接:https://pan.baidu.c ...

  9. php扩展库

    php调用C/C++动态链接库 字数997 阅读28 评论0 喜欢0 本人最近在找实习,移动开发方向.有意者可直接与本人联系.谢谢! 一.简介 一般而言,php速度已经比较快,但是,对于一些较高级开发 ...

  10. Vue.js基础2

    声明式渲染 Vue.js 的核心是一个允许采用简洁的模板语法来声明式的将数据渲染进 DOM: <div id="app"> {{ message }} </div ...