By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,421 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,421 IT Pros & Developers. It's quick & easy.

How to find size of Hashtable

P: n/a
Platform: C# (Windows Application)/XP/Framework 1.1
-----------------------------------------------------------

Hi

I am doing some performance checks, I am using a hashtable that I suspect is
not implemented effeciently.

Can someone tell me how I can find the size of memory occupied by the
hashTable?

Infact I would be glad if I can know the size of any object in general.

Thanks and Regards

Manish
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
maybe Marshal.SizeOf(object obj) will help you

"Manish Jain" <ma******@hotmail.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
Platform: C# (Windows Application)/XP/Framework 1.1
-----------------------------------------------------------

Hi

I am doing some performance checks, I am using a hashtable that I suspect is not implemented effeciently.

Can someone tell me how I can find the size of memory occupied by the
hashTable?

Infact I would be glad if I can know the size of any object in general.

Thanks and Regards

Manish

Nov 15 '05 #2

P: n/a
Hi Manish,

It depends of what you think mean with the size, it's the size of the heap
memory to instantiate it or it also include the size of those objects
created by reference, aka that lives in another place in the heap?

If an object , as is the case of Hashtable, contains references types like
a Collection then these is not enough to know the size of the Hashtable
itself but you have to add it the size of the Collection too.

I don't think that there is a way to do this on the framework, you would
need some tool, I recall that once I used a Memory profiling tool for .NET I
dont remember the name now, you have to look in the archives of this NG.
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Manish Jain" <ma******@hotmail.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
Platform: C# (Windows Application)/XP/Framework 1.1
-----------------------------------------------------------

Hi

I am doing some performance checks, I am using a hashtable that I suspect is not implemented effeciently.

Can someone tell me how I can find the size of memory occupied by the
hashTable?

Infact I would be glad if I can know the size of any object in general.

Thanks and Regards

Manish

Nov 15 '05 #3

P: n/a
CLR Profiler from MS may help

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uA**************@TK2MSFTNGP11.phx.gbl...
Hi Manish,

It depends of what you think mean with the size, it's the size of the heap memory to instantiate it or it also include the size of those objects
created by reference, aka that lives in another place in the heap?

If an object , as is the case of Hashtable, contains references types like a Collection then these is not enough to know the size of the Hashtable
itself but you have to add it the size of the Collection too.

I don't think that there is a way to do this on the framework, you would
need some tool, I recall that once I used a Memory profiling tool for .NET I dont remember the name now, you have to look in the archives of this NG.
Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Manish Jain" <ma******@hotmail.com> wrote in message
news:Op**************@tk2msftngp13.phx.gbl...
Platform: C# (Windows Application)/XP/Framework 1.1
-----------------------------------------------------------

Hi

I am doing some performance checks, I am using a hashtable that I
suspect is
not implemented effeciently.

Can someone tell me how I can find the size of memory occupied by the
hashTable?

Infact I would be glad if I can know the size of any object in general.

Thanks and Regards

Manish


Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.