473,800 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Determine the Current Memory Usage of an Assembly

I am currently running a c# service that dynamically loads assemblies
using System.Reflecti on.Assembly.Loa dFrom("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.Diagnost ics.ProcessModu le.ModuleMemory Size, 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
1 5947
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.co m
"James Wansley" <ja**********@y ahoo.com> wrote in message
news:61******** *************** **@posting.goog le.com...
I am currently running a c# service that dynamically loads assemblies
using System.Reflecti on.Assembly.Loa dFrom("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.Diagnost ics.ProcessModu le.ModuleMemory Size, 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
2891
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code that applies to all these events, but I need to have specific code execute when the form closes. The properties for this method are sender (the originator) and e (event arguments). I know how to get typeof (sender) to determine what form or...
6
3279
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that, no memory is lying around. GC reports only 84k of allocations. Starting 5-10 of this apps is going to start taking a considerable amount of memory. Is there a way to reduce this? Tom
2
2969
by: assi | last post by:
Hello all We are developing a large dotnet application, which includes ~ 120 assemblies. (total size of all binaries is ~ 20MB). Our application also references the following dotnet assemblies: System,System.XML, System.Windows.Forms, System.Drawing, System.Data, System.Design. We use dotnet framework 1.1 During initialization, the application scans a directory and loads the assemblies (using Assembly.LoadFrom). It then scans all...
11
2138
by: LordHog | last post by:
Hello, I recently wrote an application that is used for testing units in a burn-in chamber. It uses two external library that require the use of P\Invoke in order to work with them. There is a primary thread and a secondary polling thread. Every once in a while the process will consume close to 100% of the CPU, but I am unclear why. I am wondering how would I go about determine the cause of the problem? What sort of tools or...
3
1595
by: Stephajn Craig | last post by:
Hi all, I wrote a tiny little Windows Forms application that periodically checks a database for certain conditions and then pops up a message box asking if you want to do something about those conditions. It runs in the system tray. I find that when I start this program, it automatically eats up 11 MB of memory on my machine. When the prompt appears, that climbs to 17 MB. If a user answers yes to the prompt, it will open another...
35
5520
by: Alex Martelli | last post by:
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is indeed fixed. Being in a hurry, I originally used a q&d hack...: if sys.platform in ('linux2', 'darwin'): def _memsize(): """ this function tries to return a measurement of how much memory this process is consuming, in some arbitrary unit...
3
1581
by: navyliu | last post by:
I have raised a discussion about assembly unloading.But we can't get a final solution. Since we cannot unlaod a assembly,Is there any reference about this indicate that this problem won't make smartclient use up memory? Best regard navyliu
0
1089
by: Dinesh | last post by:
Hi, We are seeing high memory usage (1GB) and subsequently out of memory exception. We are trying to transform the documents using xslt and most importantly using Assembly.Evidence to avoid security exception. Is there any known issue with Assembly.Evidence and memory usage. Please help
2
2392
by: miguel | last post by:
Hi, I have created a service which parses real-time prices from one format into another. This is all working very quickly and nicely, however, I have recently found that the memory usage is astronomical after a few hours. (1.5-2 Gig) After a good amount of digging I found that the memory usage is is all in System.String and contained within the pricing object. This object makes extensive use of a single string object which is...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.