终端内存模型
理解下這玩意兒,對寫程序幫助還是挺大的,而且在看其他abap涉及內存的文章時,也容易理解一些,比如模塊池的初始化 load-of-program 其實就是放到inner session中的.
先來個圖:
不同級別的內存,分別對應各自的會話層次:
1)首先是Shared Memory: 這個通常存放代碼,數據表等全局的系統的數據信息
2)SAP Memory:這個是某個用戶所有操作所共享的空間,例如用戶的配置信息,SPA/GPA等應該就是放這里的
?? 但有個注意點,據說sap memory中不能放對象,具體原因不知,也沒試過,人家建議用DB或File System來處理
3)ABAP Memory:簡單的理解就是用戶運行的程序某個’程序’所占用的空間,不同的’程序’是相互獨立的
? 這里的’程序’要理解為sap gui中打開的一個tab,? 這個tab中運行的內容都作為一個程序看待
? 事實上這個’程序’實際運行時可能涉及代碼上的多個程序代碼 ,? 例如在程序A中 call transaction B 這時涉及 AB兩個程序的代碼
4)Inner Session:有了3)中的解釋,這里就是對應的上面提到的A 和 B各自的內存空間
所以A,B兩個程序代碼中的變量是各自獨立的,屬于各自的內部內存空間
因此export 和 import的操作就可以理解了,這是將數據放到Abap Memory中 方便各個Inner Session中的程序共享
?
關于具體的各個內存的解釋,參考以下文檔,就明白為啥用戶打開的標簽數是限制是6個,屏幕序列最多call 9 個,
SPA/GPA 和 export import操作的差異等等…
User Session
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. An additional user session can be opened by the program using a Remote Function Call with the destination “NONE”.
Main Session
For every user session, a main session is opened.?Each main session is assigned its own memory area of ABAP memory, in which data clusters can be stored.
Additional main sessions for a user session can be opened using a Remote Function Call with the addition?STARTING NEW TASK, or by entering a transaction code after?“/o”?in the input field of the toolbar.?As of release 7.0, 16 main sessions are permitted for each user session.?Before release 7.0, the maximum number was 6. The actual possible number for a particular system is defined using the system parameter rdisp/max_alt_modes, which has a default value of 6.
Internal Session
Each call of an ABAP program creates a new internal session, in which the called program is loaded.
The memory area of an internal session is divided into a roll area and a PXA. This contains the objects of a program. Technically, roll areas and the PXA are stored in the shared memory of the application server, where they are administrated by SAP Memory Management .
In one main session, there can be a maximum of nine internal sessions, which always belong to a call sequence.?Data from the ABAP memory is always assigned to a call sequence.
On 64-bit platforms, an internal session can theoretically require up to 4 TB of memory. On 32-bit platforms, the theoretical upper limit is 4 GB. The practical upper limit is usually below the theoretical limit, since the actually physically installed main memory is the maximum available and it is divided up amongst all users.
Note
Instances of classes, with the exception of shared objects, are located in the internal session.?It is therefore not possible to store references to the ABAP memory.
總結
- 上一篇: 标准程序的Parameter id 并不
- 下一篇: Access导入MDB文件