469,358 Members | 1,659 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

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 3473
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by AlexS | last post: by
5 posts views Thread by Jason Callas | last post: by
16 posts views Thread by Justin Lazanowski | last post: by
5 posts views Thread by Valerie Hough | last post: by
20 posts views Thread by jeevankodali | last post: by
8 posts views Thread by TheB | last post: by
3 posts views Thread by Florin | last post: by
7 posts views Thread by Salvador | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.