Analysing Multilayer Application

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 :-(


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

Comments

  • 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.
  • 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
Sign In or Register to comment.