473,395 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Making ones own memory profiler lite in c#

Can any-one recommend some good sites detailing how to code a simple memory
profiler?
How do they "look under the hood"?

I built an uber simple service that tracks the process' memory but I need
to "get inside" and look a bit deeper and I don't have a clue where to start
... a commercial memory profiler is not an option due the nature of the environment
the application is deployed in ..

My app runs fine for weeks (in 8 locations) but every now and again it goes
BOOOOOM
Operator feedback is non-existent so how they do it eludes me and it never
ever misbehaves in the test environment.

So my plan is to automatically detect when the app is starting to creep up
and start looking inside to see what exactly is going on. (its a plan of
sorts)

If I dont go insane before then ...
---------------------------------------------
[Sam Samson] - There is no greater folly than fixed price quoting.

Aug 30 '07 #1
3 3654
Hi Sam,

have you checked out the .Net Profiler API? there are loads of great
articles on the MSDN website:

http://msdn.microsoft.com/msdnmag/is...ETProfilerAPI/
http://msdn.microsoft.com/msdnmag/is...1/CLRProfiler/
http://msdn.microsoft.com/msdnmag/is...aspx#Resources

As for your application are you using any logging and tracing? surely you
could increase the logging when you believe the application is behaving in a
strange manner.

Why can't you use a memory profiler in product if you can't recreate the
problem in development?

HTH

Ollie Riches

"Sam Samson" wrote:
Can any-one recommend some good sites detailing how to code a simple memory
profiler?
How do they "look under the hood"?

I built an uber simple service that tracks the process' memory but I need
to "get inside" and look a bit deeper and I don't have a clue where to start
... a commercial memory profiler is not an option due the nature of the environment
the application is deployed in ..

My app runs fine for weeks (in 8 locations) but every now and again it goes
BOOOOOM
Operator feedback is non-existent so how they do it eludes me and it never
ever misbehaves in the test environment.

So my plan is to automatically detect when the app is starting to creep up
and start looking inside to see what exactly is going on. (its a plan of
sorts)

If I dont go insane before then ...
---------------------------------------------
[Sam Samson] - There is no greater folly than fixed price quoting.

Aug 30 '07 #2
Hello Ollie,

have you checked out the .Net Profiler API? there are loads of great
articles on the MSDN website:

http://msdn.microsoft.com/msdnmag/is...ETProfilerAPI/
http://msdn.microsoft.com/msdnmag/is...1/CLRProfiler/
http://msdn.microsoft.com/msdnmag/is...ing/default.as
px#Resources
Nope hadn't but now I have a starting place so shall be real soon. Thanks

As for your application are you using any logging and tracing? surely
you could increase the logging when you believe the application is
behaving in a strange manner.
I log all caught and uncaught exceptions .. but this has revealed nothing
.... I peppered the application with 'trace' points that gives me an idea
what it was doing at any given time. but I cant collect the right information
here ..
Why can't you use a memory profiler in product if you can't recreate
the problem in development?
I havent found any in-product ones yet that I could A) understand ... b)
Afford C) run on a machine in the production environment.(locked down PC's)

Thats not to say there isn't a product that fits the bill ... I just havent
found it yet.

Ollie Riches

"Sam Samson" wrote:
>Can any-one recommend some good sites detailing how to code a simple
memory
profiler?
How do they "look under the hood"?
I built an uber simple service that tracks the process' memory but I
need to "get inside" and look a bit deeper and I don't have a clue
where to start ... a commercial memory profiler is not an option due
the nature of the environment the application is deployed in ..

My app runs fine for weeks (in 8 locations) but every now and again
it goes BOOOOOM Operator feedback is non-existent so how they do it
eludes me and it never ever misbehaves in the test environment.

So my plan is to automatically detect when the app is starting to
creep up and start looking inside to see what exactly is going on.
(its a plan of sorts)

If I dont go insane before then ...

---------------------------------------------
[Sam Samson] - There is no greater folly than fixed price quoting.


Aug 30 '07 #3
Hi Sam,

I suggest you use the System.Diagnostics.Trace class as this will output
trace information in realtime, it can be viewed using a tool called Debug
Viewer

http://www.microsoft.com/technet/sys...DebugView.mspx

and also process monitor & process explorer, which gives more information
than task manager

http://www.microsoft.com/technet/sys...t.svl=featured

Also if you want to check for a memory leaks in your application you should
check Rico Mariani's blog and especially the entry about examianing
application memory.

http://blogs.msdn.com/ricom/archive/...10/279612.aspx

If you are looking for a memoery profiler check out the .Net profiler
available from MSDN, it's free

1.1

http://www.microsoft.com/downloads/d...displaylang=en

2.0

http://www.microsoft.com/downloads/d...displaylang=en

Another great profiler is Ants .Net Profiler, this will give you a 2 week
eval period.

http://www.red-gate.com/products/ants_profiler/

HTH

Ollie Riches


"Sam Samson" wrote:
Hello Ollie,

have you checked out the .Net Profiler API? there are loads of great
articles on the MSDN website:

http://msdn.microsoft.com/msdnmag/is...ETProfilerAPI/
http://msdn.microsoft.com/msdnmag/is...1/CLRProfiler/
http://msdn.microsoft.com/msdnmag/is...ing/default.as
px#Resources

Nope hadn't but now I have a starting place so shall be real soon. Thanks

As for your application are you using any logging and tracing? surely
you could increase the logging when you believe the application is
behaving in a strange manner.

I log all caught and uncaught exceptions .. but this has revealed nothing
.... I peppered the application with 'trace' points that gives me an idea
what it was doing at any given time. but I cant collect the right information
here ..
Why can't you use a memory profiler in product if you can't recreate
the problem in development?

I havent found any in-product ones yet that I could A) understand ... b)
Afford C) run on a machine in the production environment.(locked down PC's)

Thats not to say there isn't a product that fits the bill ... I just havent
found it yet.

Ollie Riches

"Sam Samson" wrote:
Can any-one recommend some good sites detailing how to code a simple
memory
profiler?
How do they "look under the hood"?
I built an uber simple service that tracks the process' memory but I
need to "get inside" and look a bit deeper and I don't have a clue
where to start ... a commercial memory profiler is not an option due
the nature of the environment the application is deployed in ..

My app runs fine for weeks (in 8 locations) but every now and again
it goes BOOOOOM Operator feedback is non-existent so how they do it
eludes me and it never ever misbehaves in the test environment.

So my plan is to automatically detect when the app is starting to
creep up and start looking inside to see what exactly is going on.
(its a plan of sorts)

If I dont go insane before then ...

---------------------------------------------
[Sam Samson] - There is no greater folly than fixed price quoting.

Aug 31 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: AlexS | last post by:
Hi, I wonder if anybody can comment if what I see is normal in FW 1.1 and how to avoid this. I have .Net assembly, which creates literally thousands of temporary strings and other objects...
5
by: Jason Callas | last post by:
I was doing starting some experimenting with the GC and ran into the following odd result. I created an object and my used memory went up by almost 11k but when I cleared it and forced a collection...
16
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from a dataset, and then pushing the dataset to a grid,...
5
by: Valerie Hough | last post by:
Currently our client runs one particular C# .NET executable, and after a few hours performance slows to a crawl. It would be very useful for me to be able to rule in (or out) the possibility that...
20
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex...
8
by: TheB | last post by:
Ok, lets try this again. I have a program which searches all disk drives for certain file types. When it finds a file it writes a record to a Firebird DB. The program normally is using 40 - 44...
0
by: Frank Lopez | last post by:
My program structure is: 1. 2. 3. => manually does the crt-init and crt-terminate calls 4. -- this is accessed by the unmanaged C++ classes in (3) using LoadLibrary and FreeLibrary
3
by: Florin | last post by:
Hi all, I have a problem related to memory grow on a server application which is basically stateless (I have some static info loaded). The client accesses this server using remoting and it has...
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.