为什么在 CCR 中使用因果关系会导致内存泄漏?

发布于 2024-07-14 23:11:25 字数 202 浏览 11 评论 0原文

有人有关于使用因果关系的信息吗? 我尝试在我的项目中使用它们,但没有成功,因为它们似乎会导致大量内存负载。

这很不寻常吗?

除了文档中给出的正常(也称为过于简单)示例之外,没有大量有关在 CCR 代码中使用因果关系的信息。

我无法给出任何代码示例,因为我删除了因果关系并用更传统的异常处理替换(尽管在 CCR 中不是传统的!)

Does anyone have information about using Causalities? I have tried unsuccessfully to use these on my project as they appeared to be causing massive memory loads.

Is this unusual?

Beyond the normal (aka overly simple) examples given in the documentation, there isn't a heck of a lot of information about using Causalities in CCR code.

I can't give any code examples per-say as I ripped the Causalities out and replaced with more conventional exception handling (not conventional in CCR though!)

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

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

发布评论

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

评论(1

葮薆情 2024-07-21 23:11:25

我最近才开始研究它们,所以我不能提供太多建议,但我会提供我能提供的:

  1. 检查代码中是否有任何循环 - 是否有可能一次又一次地产生因果关系? 一个例子是,您创建一个新的因果关系并向另一个组件发布一条消息,该消息(最终)发布回您的组件,导致原始任务再次运行,因此因果关系彼此“堆叠”。 一种方法是在添加新的 ActiveCausalities 之前检查 ActiveCausalities。
  2. 您是否考虑过尝试在添加因果关系的同一范围末尾显式删除因果关系?
  3. 显然,DSS 广泛使用因果关系,因此,如果确实存在泄漏,那么您会认为他们已经找到了它。
  4. 同意,这个主题没有足够的示例,因此如果不尝试了解实现,就很难知道最佳实践是什么。

检查这篇文章 出来。 它表明您希望在添加的范围末尾自动删除因果关系。

I've only recently started looking at them, so I can't offer much advice, but I'll offer what I can:

  1. Check whether you have any cycles in your code - is it possible that a causality is getting spawned again and again? An example of this is where you create a new causality and post a message to another component which (ultimately) posts back to your component causing the original task to run again, so the causalities 'stack' on one another. One way to do this is check ActiveCausalities before you add your new one.
  2. Did you consider trying to explicitly remove the causality at the end of the same scope where you added it?
  3. Apparently DSS uses causalities extensively, so that if there were genuinely a leak, then you'd think they'd have found it.
  4. Agreed, there aren't enough samples on this topic, so it's difficult to know what the best practice is without trying to understand the implementation.

Check this post out. It suggests that you want to automatically remove the causality at the end of the scope you added it.

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