Red Gate forums :: View topic - Analysing Multilayer Application
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
ANTS Memory Profiler Previous Versions
ANTS Memory Profiler Previous Versions forum

Analysing Multilayer Application

Search in ANTS Memory Profiler Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
John Doe



Joined: 15 Sep 2009
Posts: 10

PostPosted: Tue Sep 15, 2009 4:22 pm    Post subject: Analysing Multilayer Application Reply with quote

Hello,

I'm working on an application which is based on multiple layers:
Web GUI, Transaction, Businesslogic, DB Access and Shared object.
Each layer is developed as own project, compiled and publisched as DLL to the other layers.

to test a memory leak, I've created a simple console application that simulates the GUI and fetch a complex object.
This object is then being erased (see pseudo code below).

A simple analyse shows that the Memory increase between the first and the last snapshots, though I've expected it to be the same.

In the 'Class list' I've found some internal array (belongs indirectly to the complex object).
Those arrays appears under the filter 'GC Handle' or 'COM+'.
I've read that this might indicate a problem in unmanaged code.

Both Class References Explorer and the object retantion graph shows the following:
GC (100%) -> System.Object[] (100%) -> my.code.com.MyArray[]
which doesn't help me that much Sad


Could that also be the result of using a multilayer architecture?

Does anybody can advice me, how to find the references to those objects?

thank you

Cavin
----------------------------------------
vb.net pseudo code:

dim obj as MyObj = Nothing

... // Snapshot 1
obj = TransactionLayer.getObject()

'// Snapshot 2
obj.dispose()
obj = nothing

'// Snapshot 3
Back to top
View user's profile Send private message
AndrewH



Joined: 17 Aug 2006
Posts: 137

PostPosted: Tue Sep 15, 2009 6:15 pm    Post subject: Reply with quote

From your description, it's most likely that your object is being kept in memory by a static variable - these are implemented as GC handle object arrays internally by the CLR.

The memory profiler can usually track these and work out which variable is involved, which hides this implementation detail. There are a few circumstances where this isn't possible, however.

Most commonly, this isn't possible for .NET 1.1 applications: the profiling API was less mature then and the information simply isn't available. The solution is to configure your application to run in .NET 2 while profiling.

For .NET 2 and later, there are some problems with the CLR that can result in the profiler failing to establish static variable values. The most common issue that we see is that an application has multiple AppDomains: a .NET limitation makes it dangerous to try to read static variables in assemblies that are loaded in more than one AppDomain so we avoid this wherever possible.
_________________
Andrew Hunter
Software Developer
Red Gate Software Ltd.
Back to top
View user's profile Send private message
John Doe



Joined: 15 Sep 2009
Posts: 10

PostPosted: Wed Sep 16, 2009 2:00 pm    Post subject: Reply with quote

Hallo Andrew

thank you for your post.
this didn't helped me (yet) to locate my problem but I'm still optimistic...

I have some additional information and maybe you would have some more idea to help me.

I've noticed that if I'm taking several 'snapshot' at a time the 'private bytes' valeus changes each time with a general tendency to increase.
The other heaps stabilize after two to three snapshots.

Could that indicate a problem in unmanaged code?
Could that be an influence of AMP5 itself?
Is it possible to filter result and show only objects of Private bytes?

Another question I'm curios about:
If I understand it correctly, so each Snapshot first call a CG.
wouldn't that implies that the Gen 0 Heap Size should be empty after each Snapshot? I'm asking hence the Time line Graph sometimes show an increase in Gen 0 Heap size directly after a snapshot.

lovely greetings

Cavin
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group