Red Gate forums :: View topic - RedGate.MemoryProfiler.Snapshot.TakeSnapshot() returns false
Return to www.red-gate.com RSS Feed Available

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

RedGate.MemoryProfiler.Snapshot.TakeSnapshot() returns false

Search in ANTS Memory Profiler 7 forum
Post new topic   Reply to topic
Jump to:  
Author Message
abhijeet2083



Joined: 03 Nov 2011
Posts: 2

PostPosted: Thu Nov 03, 2011 10:44 pm    Post subject: RedGate.MemoryProfiler.Snapshot.TakeSnapshot() returns false Reply with quote

I am trying to get a snap shot from a very simple winform app when the profiler is running.
But RedGate.MemoryProfiler.Snapshot.TakeSnapshot("asd") always return false without any delay.

Any help appreciated.
Abhijeet
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6581

PostPosted: Mon Nov 07, 2011 12:55 pm    Post subject: Reply with quote

AFAIK this method should throw an exception if there is a problem and the return codes for this method are undocumented but just to clear up any potential misunderstanding:
  • Is ANTS Memory Profiler running at the same time as the application for which you've incorporated the snapshot API?
  • If so, does ANTS Memory Profiler inform you that it is taking the snapshot "asd" in its' UI?
  • If so, are any exceptions occurring in the Memory Profiler UI at the time the snapshot was invoked?
Back to top
View user's profile Send private message
abhijeet2083



Joined: 03 Nov 2011
Posts: 2

PostPosted: Mon Nov 07, 2011 8:33 pm    Post subject: RedGate.MemoryProfiler.Snapshot.TakeSnapshot() returns false Reply with quote

Thanks for the reply.
Firstly answering your questions,
- Yes, the profiler & the app invoking API are running at the same time.
- After the API invoke, there is absolutely no change on the profiler UI.

Here is something I should have mentioned in my first post.

- I got a COM unregistered exception when I tried for the first time.
- That was when I registered the assembly RedGate.Memory.Core.dll from its location inside Program Files.
- And its after this register is the behavior mentioned in the first post.
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6581

PostPosted: Tue Nov 08, 2011 11:31 am    Post subject: Reply with quote

Well, according to the source code, TakeSnapshot returns false if
  • Profiler is not connected to the process
  • The memory profiler control can't be referenced (problem with RedGate.Memory.Core.dll)
  • Profiler busy detaching with the process (or a COM exception occurs)


So I guess I would check the first thing by trying to take a snapshot in the UI. Mem profiler has probably crashed the process or it's exited on its' own. According to your last update you registered RedGate.Memory.Core.dll.
Back to top
View user's profile Send private message
jrg



Joined: 02 Jul 2010
Posts: 13

PostPosted: Mon Nov 21, 2011 6:27 pm    Post subject: Reply with quote

Just a thought - the snapshot API requires the profiled process to be started by the profiler - it's not enough for them to run at the same time.

    Start ANTS Memory Profiler.
    Set up ANTS Memory Profiler to profile your application in the normal way.
    When you click [startprofilingbutton] your application starts.
    Snapshots are taken automatically at the trigger points you defined in your code.

Quote:
I got a COM unregistered exception when I tried for the first time.

That's odd, because the memory profiler's installer should have registered the COM object. Were there any problems running the installer?
Quote:
return codes for this method are undocumented

There aren't any return codes as such, it either works (returns true), or fails (returns false), or throws an exception when the snapshot rate limiting is exceeded (5 in 30 seconds).
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