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

Determine the Current Memory Usage of an Assembly

P: n/a
I am currently running a c# service that dynamically loads assemblies
using System.Reflection.Assembly.LoadFrom("aDll.dll"). These
assemblies are stored in an arraylist after they are loaded.

I would like to periodically report the memory usage of each assembly
within the arraylist. I tried
System.Diagnostics.ProcessModule.ModuleMemorySize, but this only shows
the size of the structures within the .dll, not the current memory
usage. Does anyone know of a method to determine the memory usage of
a loaded assembly?

Thanks in advance
-James Wansley
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
James,

This is going to be rather difficult. If anything, you need to get a
tool that will profile the memory usage by class instance, from which you
could figure out which instances of which types come from which assembly
(already a big task).

However, I wouldn't recommend using any of these in production code, as
they would require you to hook into the runtime, and will most likely cause
a performance degredation.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"James Wansley" <ja**********@yahoo.com> wrote in message
news:61*************************@posting.google.co m...
I am currently running a c# service that dynamically loads assemblies
using System.Reflection.Assembly.LoadFrom("aDll.dll"). These
assemblies are stored in an arraylist after they are loaded.

I would like to periodically report the memory usage of each assembly
within the arraylist. I tried
System.Diagnostics.ProcessModule.ModuleMemorySize, but this only shows
the size of the structures within the .dll, not the current memory
usage. Does anyone know of a method to determine the memory usage of
a loaded assembly?

Thanks in advance
-James Wansley

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.