COINIT_SPEED_OVER_MEMORY是做什么的?

时间:2020-03-05 18:57:58  来源:igfitidea点击:

调用CoInitializeEx时,可以为dwCoInit指定以下值:

typedef enum tagCOINIT {
    COINIT_MULTITHREADED     = 0x0,
    COINIT_APARTMENTTHREADED = 0x2,
    COINIT_DISABLE_OLE1DDE   = 0x4,
    COINIT_SPEED_OVER_MEMORY = 0x8,
} COINIT;

提示性的"速度超过内存"值有什么作用?这些天在COM中被忽略了吗?

解决方案

回答

不知道它是否仍在使用,但它是要更改COM算法使用的余额。

如果我们有大量的内存并且不惜一切代价想要速度,则可以设置该标志。

在低内存环境中,将该标记保留为OFF将有利于减少内存使用。

事实证明,奇妙的雷蒙德·陈(Raymond Chen)("老新事物"的名声)如今已成为主题,尽管标语是要这样做的,但它显然什么也没做。

请参阅CoInitializeEx的COINIT_SPEED_OVER_MEMORY标志做什么?更多细节:

When should you enable this mode? It doesn't matter, because as far as I can tell, there is no code anywhere in COM that changes its behavior based on whether the process has been placed into this mode! It looks like the flag was added when DCOM was introduced, but it never got hooked up to anything. (Or whatever code that had been hooked up to it never shipped.)

也是来自最初的COM +架构师之一的史蒂夫·斯沃兹(Steve Swartz)的http://archives.neohapsis.com/archives/microsoft/various/dcom/2001-q1/0160.html:

COINIT_SPEED_OVER_MEMORY is ignored by COM.