How can I get the size of an object in the HttpRuntime.Cache?

I am currently storing many different types of objects in the ASP.NET HttpRuntime.Cache and I was wondering if there is a way to figure out how big each object is?


Look at these questions:

Getting the size of a field in bytes with C# Find out the size of a .net object

In particular, look for Jon Skeet's answer in those questions. They will tell you why the number won't be accurate.

As for getting an estimate, there is no way to do that unless there are certain criteria to be met for your object.

For instance, if you have many objects in the cache, sharing references to some common object instances, serializing out one of those objects in the cache will serialize out a copy of those common objects as well, inflating the results.

Need Your Help

Design a cache management API

c++ c api cache-control

I'm working on a content exchanging library that requires some cache management. For example, user can publish data with

Trying to build a metronome in kivy - Event loop management

python events loops kivy

since I haven't found anything here, I try and put my Question.

Detect Plugin or Command Existence in TinyMCE

javascript api plugins tinymce autoresize

Does TinyMCE's API support a method for finding whether or not a plugin is active, or better, whether a given command is registered? Specifically, I am creating a plugin that would like to call the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.