Fully featured low overhead profiler for Java EE and Java SE platforms.
Performance monitoring and profiling of Jenkins, TeamCity, Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Pinning data messes up YourKit

Moderators: Vladimir Kondratyev, Anton Katilin

Pinning data messes up YourKit

Postby mosmondor » Wed Sep 14, 2011 9:52 pm

Hi there!

Please look at this code:

Code: Select all
    /// <summary>
    /// Pinned pointer wrapper.  Created in this way to alow 'using' semantics.
    /// </summary>
    public sealed class PinnedPointer : IDisposable
        public IntPtr Pointer;
        GCHandle _handle;
        public PinnedPointer(byte[] Data)
            _handle = GCHandle.Alloc(Data, GCHandleType.Pinned);
            Pointer = _handle.AddrOfPinnedObject();
        public PinnedPointer(IntPtr Data)
            Pointer = Data;
        public void Dispose()
            if (_handle.IsAllocated)

That's my helper class.

I am using it with 'using' semantics...

Code: Select all
                using (PinnedPointer p = encodingData.PinnedOriginal)
                    SaveBitmap(encodingData.Stamp, p.Pointer);

and it works FINE, because it was something refactored from before, and the functionality is intact.

However, when I start the app and YourKit is running with memory profiling (even memory allocation trace isn't on!!!) memory starts to skyrocket, and in few seconds app is finished (since it allocates video frames that are large, it consumes the memory rather quickly).

Do you have an idea what is going on - since I need YourKit to be able to profile exactly this app first.

Thank you, any pointers (fixed or otherwise) would be appriciated :)
Posts: 1
Joined: Wed Sep 14, 2011 9:39 pm

Re: Pinning data messes up YourKit

Postby Anton Katilin » Thu Sep 29, 2011 2:34 pm


We cannot reporduce the problem.

Do you have an isolated code snippet which uses PinnedPointer and exposes the problem?

Best regards,
Anton Katilin
Posts: 5709
Joined: Wed Aug 11, 2004 8:37 am

Return to .NET Profiler

Who is online

Users browsing this forum: No registered users and 3 guests