对象实例布局:字符串文字?

发布于 2024-11-28 21:45:05 字数 837 浏览 5 评论 0 原文

请任何人提供有关“CLR 如何创建运行时对象” 文章?

在此处输入图像描述

我对“字符串文字”部分感到困惑,我找不到任何存储的理由这些作为每个对象实例的一部分,我什至无法推断出真正存储在那里的内容:

#US(用户字符串)流记录id?不,那些作为 ldstr 参数直接发送到 IL 中,并在运行时硬编码到 JITted 代码中。无需将其存储为每个实例的一部分。

运行时驻留实例?再说一次,不。首先,它们是常见的对象实例,实习表是 只是一个 GC 根,用于防止内部字符串被 GC 处理。 其次,可能存在任意数量的运行时驻留字符串,因此我们无法推断 基本实例大小

只是一张毫无意义的图片,字符串文字(无论作者暗示什么)没有存储为对象实例的一部分?不知道。

Please, can anyone provide more detail on the figure from the "How the CLR Creates Runtime Objects" article?

enter image description here

I'm confused with "string literals" section, I'm not able to find any reason to store those as the part of every object instance and I even could not deduct what is really stored there:

#US (user string) stream record id? No, those emitted directly into IL as a ldstr param and are hardcoded into the JITted code at runtime. There's no need to store it as a part of each instance.

Runtime-interned instances? Again, no. First, they are usual object instances and the intern table is just a GC root used to keep the interned strings from being GC'ed.
Second, there may be arbitrary number of runtime-interned strings, so we'll have no way to infer the Base Instance Size

Just a meaningless picture and the string literals (whatever the authors implied) are not stored as a part of the object instance? Don't know.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文