?
Solved

How to find what the current process is using GetCurrentProcess

Posted on 2011-02-26
5
Medium Priority
?
825 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:Janusz Czopowik
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:
Janusz Czopowik earned 1500 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

719 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