如何获得结构的内存大小? [英] How to get mem-size of a structure?

查看:141
本文介绍了如何获得结构的内存大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以获取结构使用的内存大小(例如String类型的二维数组)?我需要以记忆方式比较实现,但是找不到我需要知道的内容.我希望这不是一个愚蠢的问题:x

Is there a way to get the memory size used by a structure (say a 2-dimensional array of type String)? I need to compare implementations mem-wise, but I can't find what I need to know. I hope this isn't a too dumb question :x

推荐答案

您不一定能够从个人的内存大小中推断出输入您要获取的应用程序的运行时内存使用率.运行时内存的特性将在很大程度上取决于您使用内存的方式以及垃圾回收何时决定运行.

You won't necessarily be able to extrapolate from the memory size of individual types to the run-time memory usage of an application, if that's what you're getting at. The run-time memory characteristics will depend heavily on how you use the memory and when the garbage collection decides to run.

您能更详细地说明您要进行的比较吗?

Can you be more specific about the comparison you're trying to do?

-Tom Meschter
软件开发人员,Visual C#IDE

-Tom Meschter
Software Dev, Visual C# IDE


这篇关于如何获得结构的内存大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆