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 苦咖啡 他的博客中一篇文章完美的解 ...
随机推荐
- DuBrute 3.1
PS:转载自小残博客. 今天发现时隔很久的DuBrute竟然更新了,为此我在分享给大家,软件我没测试效果,使用过的朋友或许很清楚,不会太差! 曾几何时,小残也在用DUbrute爆破工具,且玩的不亦乐乎 ...
- python note
=和C一样,为赋值.==为判断,等于.但是,在python中是不支持行内赋值的,所以,这样避免了在判断的时候少写一个出错. dictionary 的key唯一,值可以为很多类型. list的exten ...
- IIS网站或系统验证码不显示问题——"使用了托管的处理程序,但是未安装或未完整安装 ASP.NET"
在IIS上发布了一个系统,但是登陆页面的验证码图片一直出不来,尝试了各种办法,权限.路径.继承父类路径等都不管用,进入Login.html,对着无验证码图片的图标,右键复制图片的网址,粘贴到地址栏,出 ...
- GpuImage简单使用
声明变量 @interface ********** { GPUImageVideoCamera *Camera; GPUImageOutput *Filters; GPUImageView *Cam ...
- Kali 使用ssh,安装vmware tools 和字体重叠
Kali一直是我所爱,说说遇到的问题吧 第一个:字体重叠 gnome-tweak-tool --打开工具 第二个:ssh 修改sshd_config文件,命令为: vi /etc/ssh/sshd_c ...
- ubuntu 15.10 安装swift开发环境 2016/4/17
ubuntu 15.10 64位 下载地址 https://swift.org/download/#using-downloads 1.首先在ubuntu终端上 (ctl+alt+t打开) 下载cla ...
- 使用visual studio 调试android 程序 ,真机调试
1 使用visual studio 2015 新建 blank android APP , 2 安卓手机调整到开发者模式 3 通过USB链接到PC 4 自动检测 设备(这一步貌似没有立即检测到真机设备 ...
- Gitlab完美安装【CentOS6.5安装gitlab-6.9.2】
摘要: 拆腾了几天,终于在今天找到了快速安装Gitlab的方法.CentOS6.5安装gitlab-6.9.2 参考网址:https://gitlab.com/gitlab-org/omnibus-g ...
- Uiautomator--断言的使用
一.断言函数的使用 1.用例结构: 自动化用例结构,一般可以分成一个用例集,然后用例集下面会有非常多的用例组成,我们可以从多个用例中抽出一些用例组成测试套件. 2.用例的标准结构: setUp:初始化 ...
- checkbox check all or ancheck all
<script type="text/javascript" src="js/jQuery.1.8.3.min.js"></script> ...