C++: Virtual Table and Shared Memory
See at:
补充栏3: C++对象和共享内存 (叙述内容和Link1的内容基本一致)
《C++网络编程 卷1:运用ACE和模式消除复杂性》 《C++ Network Programming Volume 1 Mastering Complexity with ACE and Patterns》 -Douglas C.Schmidt, Stephen D. Huston -叶斌译
关于这个问题的一个扩展: p49, class ACE_IPC_SAP的constructor为protected, 这样可以防止其被直接实例化,同时避免了虚指针。
关于这个问题的另一个扩展: p106, 在多线程情况下,可以使用含有虚表的C++对象,利用进程局部内存的公用数据结构。
Link1:
Is it possible to store polymorphic class in shared memory? -> No
http://stackoverflow.com/questions/12969391/is-it-possible-to-store-polymorphic-class-in-shared-memory
引自
http://www.boost.org/doc/libs/1_51_0/doc/html/interprocess/sharedmemorybetweenprocesses.html#interprocess.sharedmemorybetweenprocesses.mapped_region_object_limitations
Virtuality forbidden
The virtual table pointer and the virtual table are in the address space of the process that constructs the object, so if we place a class with a virtual function or virtual base class, the virtual pointer placed in shared memory will be invalid for other processes and they will crash.
This problem is very difficult to solve, since each process needs a different virtual table pointer and the object that contains that pointer is shared across many processes. Even if we map the mapped region in the same address in every process, the virtual table can be in a different address in every process. To enable virtual functions for objects shared between processes, deep compiler changes are needed and virtual functions would suffer a performance hit. That's why Boost.Interprocess does not have any plan to support virtual function and virtual inheritance in mapped regions shared between processes.
..
C++: Virtual Table and Shared Memory的更多相关文章
- ORA-27125: unable to create shared memory segment的解决方法(转)
ORA-27125: unable to create shared memory segment的解决方法(转) # Kernel sysctl configuration file for Red ...
- Multiple address space mapping technique for shared memory wherein a processor operates a fault handling routine upon a translator miss
Virtual addresses from multiple address spaces are translated to real addresses in main memory by ge ...
- Android系统匿名共享内存(Anonymous Shared Memory)C++调用接口分析
文章转载至CSDN社区罗升阳的安卓之旅,原文地址:http://blog.csdn.net/luoshengyang/article/details/6939890 在Android系统中,针对移动设 ...
- 参数SID写错,ERROR OGG-00664 ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist
添加进程,启动进程报错 1.0添加进程 GGSCI (t2) > add ext exta,tranlog,begin now EXTRACT added. --添加exta(ext标准命名规则 ...
- ORA-04031: Unable To Allocate 32 Bytes Of Shared Memory
记录一次生产库遇到的4031错误,后来通过调整sga大小将问题解决了 报错信息: ORA-04031: 无法分配 32 字节的共享内存 ("shared pool","s ...
- RAC数据库的ORA-27123: Unable To Attach To Shared Memory Segment Linux-x86_64 Error: 22: Invalid argument
RAC数据库的 ORA-27123: Unable To Attach To Shared Memory Segment Linux-x86_64 Error: 22: Invalid argumen ...
- ORA-27101: shared memory realm does not exist
Oracle Error Tips by Burleson Consulting Oracle docs note this about ORA-27101: ORA-27101: shared me ...
- shared memory realm does not exist
有天启动ORACLE,碰到如下问题 提示ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist 解决 ...
- Oracle重启 error: ora-01034:oracle not available ora-27101:shared memory realm does not exist
error: ora-01034:oracle not available ora-27101:shared memory realm does not exist 苦咖啡 他的博客中一篇文章完美的解 ...
随机推荐
- 云服务器 Centos7.0 部署
CentOS安装jdk的三种方法 http://www.mamicode.com/info-detail-613410.html centos Linux下安装Tomcat和发布Java的web程序 ...
- css text-overflow:ellipsis 文字多余剪切
text-overflow: ellipsis;多度剪切white-space: nowrap;禁止换行overflow: hidden;多余隐藏
- 使用Ruby来实现批量更新AD中字段
准备工作 安装需要用到的gem gem install net-ldap gem install roo 准备好要更新的数据,比如exel表: /root/account.xlsx,内容如下 姓名 性 ...
- c#延迟加载
public class BlogUser { public int Id { get; private set; } public Lazy<List<Article>> A ...
- ACM/ICPC 之 Dinic+枚举最小割点集(可做模板)(POJ1815)
最小割的好题,可用作模板. //Dinic+枚举字典序最小的最小割点集 //Time:1032Ms Memory:1492K #include<iostream> #include< ...
- ACM/ICPC 之 DP解有规律的最短路问题(POJ3377)
//POJ3377 //DP解法-解有规律的最短路问题 //Time:1157Ms Memory:12440K #include<iostream> #include<cstring ...
- 进程管理supervisor的简单说明
背景: 项目中遇到有些脚本需要通过后台进程运行,保证不被异常中断,之前都是通过nohup.&.screen来实现,带着能否做一个start/stop/restart/reload的服务启动的想 ...
- OC编程之道-接口适配之适配器
已有的类与新的接口之间不兼容的问题相当普遍,人们已为它找到了一个解决方案.这个解决方案就是适配器. 1 何为适配器 what 适配器的主要作用是把被适配者的行为传递给管道另一端的客户端. 将一个类的接 ...
- Uiautomator--Uiselector元素定位
一.UiSelector作用 按照一定的条件(例如控件的text值,资源id),定位界面上的元素.UiSelector对象的最终目的是去构造一个UiObject对象. 二.元素定位 1.根据text定 ...
- ssdb binlog机制 存疑
int BinlogQueue::del_range(uint64_t start, uint64_t end){ while(start <= end){ leveldb::WriteBatc ...