当有它不可序列化对象

当有它不可序列化对象

本文介绍了如何找出ASP.NET会话的大小,当有它不可序列化对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我把相当多的数据在我的ASP.NET会话的感觉,但我不知道我是多么如果应该关注。我发现了一个similar问题,而是依赖于序列化对象,并检查他们的系列大小。在我的情况下,在会话中的大部分数据是从哪个没有它的类标记为可序列化的另一个库的对象。 (我知道,这限制了我使用的是InProc会话状态提供者,但那是另一个问题)。有没有人对如何遍历对象图的想法,并找出它的大小?

I have a feeling that I'm putting rather much data in my ASP.NET session, but I've no idea how much and if I should be concerned. I found a similar question, but that relies on serializing objects and checking their serialized size. In my case the majority of data in the session is in objects from another library which doesn't have its classes marked as "Serializable". (I know that this restricts me to using InProc session state provider, but that's another issue). Does anyone have an idea on how to traverse the object graph and find out its size?

补充:确定,一种方法是对象图和Marshal.SizeOf()方法的使用手册遍历。但是,这是一个很大写来获取工作的。是否有可能达到同样的效果更简单的方法?我的目标不是字节precision,我感兴趣的量级(千字节,兆字节,几十兆的...)

Added: OK, one way would be a manual traversal of the object graph and usage of Marshal.SizeOf() method. But that's a lot of writing to get that working. Is there perhaps a simpler way of achieving the same effect? I'm not aiming for byte precision, I'm interested in the order of magnitude (kilobytes, megabytes, tens of megabytes...)

推荐答案

你能不能产生一个堆转储,并找到该会话的大小。在java中的土地,我可以转储堆然后打开它,找到会话对象,并找出大小子的。

can't you generate a heap dump and find the size of the session from that. in java land i can dump the heap then open it up in mat, find the session object and find out the size of the subgraph.

这篇关于如何找出ASP.NET会话的大小,当有它不可序列化对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 11:34