Solved

How to find what the current process is using GetCurrentProcess

Posted on 2011-02-26
5
818 Views
Last Modified: 2013-11-20
I am trying to do some debugging of a program which gives some users a RunTime 226 error in a CAD program which we sit our dll based program on.  I cannot replicate the error so I am trying to track if my system is losing memory somewhere.

I can get the current process memory usage  with GetProcessMemoryInfo(GetCurrentProcess, etc. but I need to make sure that GetCurrentProcess is my dll functions, I have established that it is not the CAD engine.  

How do I get the name of the process for which I am getting the memory values.
0
Comment
Question by:R_A_Martin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:JohnCz
ID: 34987848
I do not quite understand the forst part of your post so I am not sure why you are trying to get memory information from other process. It also can be a registry problem.
Try cleaning registry and reinstalling program in question.

Answering the second part of your post:
Use EnumProcesses to get all processes IDs. For each ID call OpenProcess to get a handle and use this handle and call EnumProcessModules passing this handle and use GetModuleBaseName to retreive name.
Use module name to determine if this is a mosule you are trying to collect info anf use this process ID to call GetProcessMemoryInfo.
0
 

Author Comment

by:R_A_Martin
ID: 34988409
John

Thanks that pointed me in the right direction and it has confirmed that current process was the CAD engine.

I now have to work out why calling the function to send the data to the separate debug logging exe seems to increase the memory used by the system all the time.
0
 
LVL 5

Accepted Solution

by:
JohnCz earned 500 total points
ID: 34988638
Where this function is called from? What is called to send a date?
Without debugging session I am not able to answer this question.

The most common problem with growing memory used by a process, is to allocate memory on the heap and not release it when is not needed.
Another common problem is to allocate windows resources and not releasing them. For example repetitive calling GetDC without releasing it will cause memory problrms.
0
 

Author Comment

by:R_A_Martin
ID: 34990768
Thanks. I am going to investigate further why the workingSetSize is growing. I have a separate program which I send information to from functions in the dll, I think this is perhaps where the issue might be.
0
 

Author Closing Comment

by:R_A_Martin
ID: 35045260
Not the complete answer
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question