views:

64

answers:

5

Where can I find reliable information regarding project resources and memory? I'd like to know when resources are loaded into memory from the dll, when they are removed by the GC etc.

Reason is my app carries the help-file topics as HTML-Strings inside the source, and I'm about to add the possibility to include images. I don't care if my dll-size grows substantially, but I do care if the memory-footprint of my app grows substantially.

+1  A: 

Take a look at this blog it has excellent information on debuging techniques to find issue also take a look at son of strike which is more .net centric.

rerun
Cool blog, bookmarked. I'm not debugging anything yet though, I want to learn more about the topic before I start writing code.
David Rutten
+1  A: 

This application will give you a lot (if not all) of that information, but it's kind of hard to read.

There are a couple different versions of it for different versions of .Net. The one I have linked is the one for 3.5 I believe.

md5sum
+1  A: 

A memory profiler will help you with this information. I can recommend SciTech .Net Memory Profiler, but there are more options. See the answers to this question for example.

Lars Truijens
Hi Lars, since I haven't done any of this yet, there is nothing to profile. I'm merely looking for information about the implementation of Resources in DotNET dlls.
David Rutten
Ah ok. Still might help you figure it out with the help of some proof of concept applications and some good measurements of a tool like this.
Lars Truijens
+1  A: 

It sounds like you might be looking for a memory profiler. The one from SciTech is pretty good: .NET Memory Profiler. They have a free two week trial.

RickNZ
Thanks Rick, but I wasn't. I was looking for implementation details of DotNET resources. I want to know more about the theory behind it all.
David Rutten
Ah, right -- "resources" is such an overloaded term in .NET....
RickNZ
+1  A: 

I'm not entirely sure if .NET works the same as plain Win32, but the way it normally works is:

Embedded resources (i.e. resource strings) in DLLs/EXEs are loaded into memory as soon as the library/app is loaded. However, if the resources are not used for a long time, they can be unloaded / paged out. Thus you don't really need to worry about running out of memory.

Having said that - HTML help isn't such a great thing to shove inside a program. If you have a lot of it, I'd really suggest storing it somewhere external to the app. That's what formats like CHM are for.

Update:

Based on your comment, I think you might want to look into satellite assemblies. This is a very common approach when you need to store large amounts of embedded resources that will be used infrequently (or not at all), i.e. for localization. They are still compiled assemblies which should hopefully fit into your plugin system.

Each plugin would effectively be two assemblies, one loaded by your main app and another declared as a reference inside the plugin. Everything is still completely self-contained, but you don't load the satellite DLL until a user actually asks for help.

Aaronaught
Thanks Aaron,then I hope it doesn't work like plain Win32. I can't use a single CHM file since my application is basically only a framework. The real functionality is supplied by maybe dozens, possibly hundreds of little plug-in dlls, each of these needs to be able to add to the main helpfile, as though they were part of the base app.
David Rutten
My instinct would be to believe that the same thing will happen in .NET. After all, the CLR is essentially a huge COM wrapper which is in turn just a huge DLL wrapper; none are exempt from the traditional rules of dynamic linking.
Aaronaught