如何以编程方式控制COM垃圾回收? [英] How can I programmatically control COM garbage collection?

查看:80
本文介绍了如何以编程方式控制COM垃圾回收?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个C ++ ATL项目,一个实现COM客户端,另一个实现COM服务器。客户端将服务器创建为COM本地服务器(进程外),并将服务器的COM接口提供回客户端。服务器使用
此接口在客户端内存空间中创建对象。 

I have two C++ ATL projects, one implementing a COM client, and one implementing a COM server. The client creates the server as a COM local server (out of process), and provides the server with a COM interface back into the client. The server uses this interface to create objects in the client memory space. 

如果服务器崩溃(例如nullptr异常),服务器创建的对象客户端内存空间悬挂在客户端内存空间中,因为服务器从未有机会减少这些对象的引用计数。 

If the server crashes (for example a nullptr exception), the objects created by the server in the client memory space are dangling in the client memory space, because the server never got the chance to reduce the reference count of these objects. 

我们看到的是这些悬空物体在服务器崩溃大约5-15分钟后仍然被销毁,我们假设COM已经实现了某种垃圾收集。

What we see, is that these dangling objects are still being destroyed after approximately 5-15 minutes after the server crashed, and we assume COM has implemented some kind of garbage collection.

问题:有没有办法以编程方式强制COM垃圾收集运行得更快?

Question: Is there any way of programmatically forcing the COM garbage collection to run sooner?

Jøger

推荐答案

RpcSs服务在本地计算机上实现DCOM垃圾收集机制。 据我所知,这种机制无法以编程方式访问。
The RpcSs service implements the DCOM garbage collection mechanism on a local machine.  As far as I know, this mechanism is not programmatically accessible.


这篇关于如何以编程方式控制COM垃圾回收?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆