(gc.trystartnogcregion())未实施该方法或操作。在单声道上

发布于 2025-02-12 20:06:32 字数 610 浏览 0 评论 0原文

我试图阻止C#收集垃圾一段时间。 我发现可以使用gc.trystartnogcregion()方法来做到这一点。 但是,这引发了以下例外:

未经治疗的例外: system.notimplemplededException:未实现该方法或操作。 在system.gc.gc.startnogcregionworker(system.int64 catsalsize,system.boolean haslohsize,system.int.int64 lohsize,system.boolean disallawallufullblockinggc)in< 1400EA11D6FD49D49D49D49D4939BE6BE6BBE686ABB4&GTB4 在system.gc.gc.trystartnogcregion(system.int64 caltalsize,system.boolean disallyfullblockinggc)[0x00000] in< 1400EA11D6FD49D49D49D4939BE686A9549549FB4

...

GC.TryStartNoGCRegion(4096, true)

I'm trying to stop C# from collecting garbage for some time.
I found that I can do this using the GC.TryStartNoGCRegion() method.
However, this throws this exception:

Unhandled Exception:
System.NotImplementedException: The method or operation is not implemented.
at System.GC.StartNoGCRegionWorker (System.Int64 totalSize, System.Boolean hasLohSize, System.Int64 lohSize, System.Boolean disallowFullBlockingGC) [0x00000] in <1400ea11d6fd49d4939be686a9549fb4>:0
at System.GC.TryStartNoGCRegion (System.Int64 totalSize, System.Boolean disallowFullBlockingGC) [0x00000] in <1400ea11d6fd49d4939be686a9549fb4>:0 ...

I executed this line of code:

GC.TryStartNoGCRegion(4096, true)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一身骄傲 2025-02-19 20:06:32

显然是单声道本身会导致错误。在源代码gc.trystartnogcregion()中抛出一个system.notimplementedexception。

Apparently it is Mono itself causing the error. In the source code GC.TryStartNoGCRegion() throws a System.NotImplementedException.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文