eXtremeDB 共享内存使用时的注意事项
2015-01-11 20:44
190 查看
When using the eXtremeDB Direct Pointer Arithmetic library (DP) it is
necessary to map the shared memory segment to the same virtual memory address
in every process because in the DP implementation eXtremeDB uses actual
memory addresses (i.e. it performs pointer arithmetic) to calculate the locations of
objects in an eXtremeDB database. The pointers must be the same in every
running instance of an eXtremeDB -based application, or pointer arithmetic just
doesn’t work. Setting the dev.named.hint parameter to zero causes eXtremeDB
to determine the actual shared memory segment address. But this could fail when
called from a second process attempting to open the shared database. In this case
it is the applications responsibility to provide a valid “hint” address.
There are several ways to determine where the runtime should map the shared
memory database. Developers can use a utility provided by the operating system
to gather memory usage information (the process memory map). These utilities
will usually display the code, data and stack memory usage of each process
running on the system and the libraries it is using. It is necessary to examine the
output and pick an address outside any address space.
In any event, the memory address is an address in each process’s virtual memory.
An address should be chosen that is sufficiently far away from the data, stack and
heap segment of every process that will share the database. (Hence the default of
0x20000000 for MAP_ADDRESS; it is assumed unlikely, but not guaranteed, that
any single process will have data, stack and heap that stretch out to 0x20000000
bytes.)
The above potential issues with respect to the MAP_ADDRESS can be avoided by
using the “Offset” library instead of the Direct Pointer Arithmetic library. The
“Offset” approach calculates an offset from the beginning address of the inmemory
database, to locate objects. Therefore, it does not depend on the inmemory
database starting at a common (and known) location for all processes.
However, the DP pointer arithmetic is about 5%–15% faster than calculating
offsets.
necessary to map the shared memory segment to the same virtual memory address
in every process because in the DP implementation eXtremeDB uses actual
memory addresses (i.e. it performs pointer arithmetic) to calculate the locations of
objects in an eXtremeDB database. The pointers must be the same in every
running instance of an eXtremeDB -based application, or pointer arithmetic just
doesn’t work. Setting the dev.named.hint parameter to zero causes eXtremeDB
to determine the actual shared memory segment address. But this could fail when
called from a second process attempting to open the shared database. In this case
it is the applications responsibility to provide a valid “hint” address.
There are several ways to determine where the runtime should map the shared
memory database. Developers can use a utility provided by the operating system
to gather memory usage information (the process memory map). These utilities
will usually display the code, data and stack memory usage of each process
running on the system and the libraries it is using. It is necessary to examine the
output and pick an address outside any address space.
In any event, the memory address is an address in each process’s virtual memory.
An address should be chosen that is sufficiently far away from the data, stack and
heap segment of every process that will share the database. (Hence the default of
0x20000000 for MAP_ADDRESS; it is assumed unlikely, but not guaranteed, that
any single process will have data, stack and heap that stretch out to 0x20000000
bytes.)
The above potential issues with respect to the MAP_ADDRESS can be avoided by
using the “Offset” library instead of the Direct Pointer Arithmetic library. The
“Offset” approach calculates an offset from the beginning address of the inmemory
database, to locate objects. Therefore, it does not depend on the inmemory
database starting at a common (and known) location for all processes.
However, the DP pointer arithmetic is about 5%–15% faster than calculating
offsets.
相关文章推荐
- 【简短笔记】mysql内存表使用注意事项
- iphone使用loadNibNamed载入view在内存中得注意事项
- 使用malloc函数申请内存空间注意事项
- java使用sigar获取linux系统内存使用信息 注意事项
- TokuDB7.5.7-2.4.1使用TokuDB时的内存注意事项v1
- ARC内存使用注意事项
- 黑马程序员-C语言中内存动态分配函数的使用方法及注意事项
- 使用SetUnhandledExceptionFilter转储程序崩溃时内存DMP注意事项
- 20、IPC共享内存使用注意点
- ARC内存使用注意事项
- ARC内存使用注意事项
- C# 非托管内存使用时的注意事项
- 牛客网Java刷题知识点之匿名对象、匿名对象的内存结构图、匿名对象的应用场景、匿名对象的使用、匿名对象的简单例子、匿名对象要注意的事项
- 计算机共享使用注意事项
- 使用SetUnhandledExceptionFilter转储程序崩溃时内存DMP注意事项
- VC6中使用内存DC加载并显示JPG图片的注意事项
- static关键字:解决的问题,在内存中的特点和使用注意事项
- iphone使用loadNibNamed载入view在内存中得注意事项
- js闭包避免内存泄漏 减少内存使用 避免对象无法回收注意事项
- VC6中使用内存DC加载并显示JPG图片的注意事项