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 苦咖啡 他的博客中一篇文章完美的解 ...
随机推荐
- sublime3的安装和插件之类的
1.http://www.sublimetext.com/3 选择适合自己电脑的下载 2.下载完之后打开,help -> enter lisence 谷了下注册码如下,粘贴过去,万一不行请自由飞 ...
- 微信小程序常见问题集合(长期更新)
最新更新: 新手跳坑系列:推荐阅读:<二十四>request:fail错误(含https解决方案)(真机预览问题 跳坑指南<七十>如何让微信小程序服务类目审核通过 跳坑六十九: ...
- Ubuntu14.04 64位配置Caffe 教程(基于CUDA7.5)
最新博客地址已转到: http://blog.csdn.net/zzlyw?viewmode=contents ------------------------------------------ ...
- ajax简单应用
var xmlhttp;if (window.XMLHttpRequest) { // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码 xmlhttp=new ...
- 执行ssh-add时出现Could not open a connection to your authentication agent
若执行ssh-add /path/to/xxx.pem是出现这个错误:Could not open a connection to your authentication agent,则先执行如下命令 ...
- git服务器搭建总结
1.软件选择 服务端软件:由于我对linux还不熟悉,而且公司用的都是windows,于是找到了bonobo,这是一个基于.net framework 4.5和.net mvc4的开源软件,iis7. ...
- DevExpress 隐藏Ribbon中barbuttonItem的SuperTip(1)
public frmMain() { InitializeComponent(); ribbonControl1.Manager.HighlightedLinkChanged += Manager_H ...
- javaWeb项目中如何实现在线查看pdf文件
最近有需求要实现在网页直接查看pdf,word,excel文件.但是实际当中并没有很好的开源插件供我们使用,确实有一些付费的插件不错,也很好用,但是对于我来说都不适合. 现在只是单纯的找到了围魏救赵的 ...
- MAC 常用命令
杀死占用某个端口的进程 命令 lsof -i tcp:port port换成端口号可以查看端口是被哪个程序占用 --> kill -9 pid 杀死进程
- CodeForces 589J Cleaner Robot
题目链接 题意:一个机器人打扫卫生,URDL代表初始时机器人面对的方向上右下左. ' . ' 代表可以打扫的, ' * ' 代表家具,如果机器人遇到家具就顺时针转90度,问机器人能打扫多少面积. 题解 ...