SAP专家培训之Netweaver ABAP内存管理和内存调优最佳实践
培训者: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内存管理和内存调优最佳实践的更多相关文章
- JVM | 第1部分:自动内存管理与性能调优《深入理解 Java 虚拟机》
目录 前言 1. 自动内存管理 1.1 JVM运行时数据区 1.2 Java 内存结构 1.3 HotSpot 虚拟机创建对象 1.4 HotSpot 虚拟机的对象内存布局 1.5 访问对象 2. 垃 ...
- JVM的内存结构以及性能调优
JVM的内存结构以及性能调优 发布时间: 2017-11-22 阅读数: 16675 JVM的内存结构以及性能调优1:JVM的结构主要包括三部分,堆,栈,非堆内存(方法区,驻留字符串)堆上面存储的是引 ...
- 【Bugly干货分享】iOS内存管理:从MRC到ARC实践
Bugly 技术干货系列内容主要涉及移动开发方向,是由Bugly邀请腾讯内部各位技术大咖,通过日常工作经验的总结以及感悟撰写而成,内容均属原创,转载请标明出处. 对于iOS程序员来说,内存管理是入门的 ...
- davlik虚拟机内存管理之一——内存分配
转载自http://www.miui.com/thread-74715-1-1.html dalvik虚拟机是Google在Android平台上的Java虚拟机的实现,内存管理是dalvik虚拟机中的 ...
- Delphi的内存管理及内存泄露问题 FastMM4
这几天因为一个程序长时间运行出现比较严重的内存泄露问题,开始关注了一下内存管理方面的东西,以前也注意内存管理,创建了对象及时释放,但总有忘了处理的情况. 在Delphi中没有自动回收机制,所以一定要及 ...
- window内存管理与内存原理
转自: http://blog.csdn.net/iamfranter/article/details/6826270 WIndows为每个进程分配了4GB的虚拟地址空间,让每个进程都认为自己拥有4G ...
- Objective-C 【内存管理&手动内存管理 综述】
------------------------------------------- 内存管理 (1)Objective-C的内存管理 栈区 存放局部变量(由于基本数据类型占用的存储空间是固定 ...
- Android 之 内存管理-查看内存泄露(三)
概述 在android的开发中,要时刻主要内存的分配和垃圾回收,因为系统为每一个dalvik虚拟机分配的内存是有限的,在google的G1中,分配的最大堆大小只有16M,后来的机器一般都为24M,实在 ...
- Java的内存管理与内存泄露
作为Internet最流行的编程语言之一,Java现正非常流行.我们的网络应用程序就主要采用Java语言开发,大体上分为客户端.服务器和数据库三个层次.在进入测试过程中,我们发现有一个程序模块系统内存 ...
随机推荐
- python日志模块logging学习
介绍 Python本身带有logging模块,其默认支持直接输出到控制台(屏幕),或者通过配置输出到文件中.同时支持TCP.HTTP.GET/POST.SMTP.Socket等协议,将日志信息发送到网 ...
- C#中加粗label的字体
1. 在C#的代码中想直接加粗label控件的字体, label1.Font.Bold = true;//发现系统会提示Font.Bold是只读属性 如果必须要加粗字体呢,方法如下: 2. 使用Fon ...
- UEditor编辑器 字符数统计和字符数限制 问题
1.百度UEditor修改右下角统计字数默认只统计前台所见的文字个数,为了便于展示实际保存的时候是保存的包含html标签的,所以右下角的统计字数功能需要修改 getContentLength: fun ...
- 45 Useful Oracle Queries--ref
http://viralpatel.net/blogs/useful-oracle-queries/ Here’s a list of 40+ Useful Oracle queries that e ...
- Redis 常见命令
0. 5种数据类型 String(字符串) List(列表) Hash(字典) Set(集合) Sorted Set(有序集合) 1. String 字符串 set key value 设置key=v ...
- 官网下载apache服务器并运行
1.打开官网 https://httpd.apache.org/ 2.找到下载位置,比如我们要下载2.x版本 点击download,在下一页找到 Files for Microsoft Wi ...
- websocket 和 dwr 做web端即时通信
一.WebSocket是HTML5出的东西(协议),也就是说HTTP协议没有变化,或者说没关系,但HTTP是不支持持久连接的(长连接,循环连接的不算) 首先HTTP有1.1和1.0之说,也就是所谓的k ...
- php编程--二叉树遍历算法实现
今天使用php来实现二叉树的遍历 创建的二叉树如下图所示 php代码如下所示: <?php class Node { public $value; public $child_l ...
- 用css3+js写了一个钟表
有一天看到css3旋转这个属性,突发奇想的写了一个钟表(没做浏览器兼容),来一起看看是怎么写的吧! 先给个成品图,最终结果是个样子的(动态的). 首先,思考了一下页面的布局,大致需要4层div,最底层 ...
- Python基础-简介二
一.变量类型 变量存储在内存中的值.这就意味着在创建变量时会在内存中开辟一个空间. 基于变量的数据类型,解释器会分配指定内存,并决定什么数据可以被存储在内存中. 因此,变量可以指定不同的数据类型,这些 ...