非托管对象的 GC.AddMemoryPressure
对于非托管对象使用 Add/RemoveMemoryPressure 的正确方法是什么?我有一个非托管对象,但它大量使用了 STL 容器等。我是否应该随着非托管对象总大小的每次更改而不断更新托管 GC?或者只是原始分配大小?我什么时候调用RemoveMemoryPressure?终结器?处置()?
What is the correct way to use Add/RemoveMemoryPressure for unmanaged objects? I have an unmanaged object- but it makes heavy use of, e.g., STL containers. Am I supposed to constantly update the managed GC with every change to the total size of the unmanaged object? Or just it's raw allocation size? And when do I call RemoveMemoryPressure? Finalizer? Dispose()?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自此处(并由 @Wim Coenen 注明):
因此,您必须决定投入多少精力来跟踪这些变化以及您将获得多少好处。
From here (and noted by @Wim Coenen):
So you have to decide how much effort to put into tracking these changes and how much benefit you will get.