• <bdo id='0U5fV'></bdo><ul id='0U5fV'></ul>

    <small id='0U5fV'></small><noframes id='0U5fV'>

        <tfoot id='0U5fV'></tfoot>

      1. <legend id='0U5fV'><style id='0U5fV'><dir id='0U5fV'><q id='0U5fV'></q></dir></style></legend>

        <i id='0U5fV'><tr id='0U5fV'><dt id='0U5fV'><q id='0U5fV'><span id='0U5fV'><b id='0U5fV'><form id='0U5fV'><ins id='0U5fV'></ins><ul id='0U5fV'></ul><sub id='0U5fV'></sub></form><legend id='0U5fV'></legend><bdo id='0U5fV'><pre id='0U5fV'><center id='0U5fV'></center></pre></bdo></b><th id='0U5fV'></th></span></q></dt></tr></i><div id='0U5fV'><tfoot id='0U5fV'></tfoot><dl id='0U5fV'><fieldset id='0U5fV'></fieldset></dl></div>

        C# + COM 互操作,确定性发布

        时间:2023-07-26

        <small id='uNZTI'></small><noframes id='uNZTI'>

        <i id='uNZTI'><tr id='uNZTI'><dt id='uNZTI'><q id='uNZTI'><span id='uNZTI'><b id='uNZTI'><form id='uNZTI'><ins id='uNZTI'></ins><ul id='uNZTI'></ul><sub id='uNZTI'></sub></form><legend id='uNZTI'></legend><bdo id='uNZTI'><pre id='uNZTI'><center id='uNZTI'></center></pre></bdo></b><th id='uNZTI'></th></span></q></dt></tr></i><div id='uNZTI'><tfoot id='uNZTI'></tfoot><dl id='uNZTI'><fieldset id='uNZTI'></fieldset></dl></div>

          <bdo id='uNZTI'></bdo><ul id='uNZTI'></ul>
        • <tfoot id='uNZTI'></tfoot>

                <tbody id='uNZTI'></tbody>

            • <legend id='uNZTI'><style id='uNZTI'><dir id='uNZTI'><q id='uNZTI'></q></dir></style></legend>

                  本文介绍了C# + COM 互操作,确定性发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  COM 对象通常具有确定性破坏:它们在最后一个引用被释放时被释放.

                  COM objects usually have deterministic destruction: they are freed when the last reference is released.

                  在 C# - COM 互操作中如何处理?这些类没有实现 IDisposable,所以我看不到触发显式 IUnknown::Release 的方法.

                  How is this handled in C# - COM Interop? The classes don't implement IDisposable, so I see no way to trigger an explicit IUnknown::Release.

                  一个偶然的测试表明,未引用的 COM 对象被延迟收集(即垃圾收集器正在触发释放).对于需要积极释放的 OCM 对象,我该怎么办?(例如,持有大量或共享的关键资源)?

                  A casual test shows that unreferenced COM objects get collected lazily (i.e. the garbage collector is triggering the release). What should I do for OCM objects that need to be released aggresively? (e.g. holding large or shared critical ressources)?

                  原始问题:我们有一个 C# 应用程序大量使用 COM 库,并且它正在疯狂地泄漏.似乎问题在于 C++ 和 C# 代码之间"(我们可以访问两者),但我们无法确定.

                  Original problem: We have a C# application heavily using a COM library, and it is leaking like mad. It seems that the problems is "between" the C++ and the C# code (we have access to both), but we can't nail it down.

                  推荐答案

                  您可以使用 System.Runtime.InteropServices.Marshal 类来操作 COM 互操作引用.具体来说,您可能想看看 Marshal.释放ComObject.

                  You can manipulate COM interop references using the System.Runtime.InteropServices.Marshal class. Specifically you may want to have a look at Marshal.ReleaseComObject.

                  这篇关于C# + COM 互操作,确定性发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:将 JPEG 图像转换为字节数组 - COM 异常 下一篇:用自定义 VBA 类包装 .Net ArrayList 获取迭代器

                  相关文章

                  <small id='W2mNY'></small><noframes id='W2mNY'>

                  1. <legend id='W2mNY'><style id='W2mNY'><dir id='W2mNY'><q id='W2mNY'></q></dir></style></legend><tfoot id='W2mNY'></tfoot>

                    <i id='W2mNY'><tr id='W2mNY'><dt id='W2mNY'><q id='W2mNY'><span id='W2mNY'><b id='W2mNY'><form id='W2mNY'><ins id='W2mNY'></ins><ul id='W2mNY'></ul><sub id='W2mNY'></sub></form><legend id='W2mNY'></legend><bdo id='W2mNY'><pre id='W2mNY'><center id='W2mNY'></center></pre></bdo></b><th id='W2mNY'></th></span></q></dt></tr></i><div id='W2mNY'><tfoot id='W2mNY'></tfoot><dl id='W2mNY'><fieldset id='W2mNY'></fieldset></dl></div>

                      • <bdo id='W2mNY'></bdo><ul id='W2mNY'></ul>