Hello C++ experts,
I am a VB programmer mostly and I have code that enumerates the currently running processes of the PC using CreateToolhelp32Snapshot... but it has recently come to my attention that every time CreateToolhelp32Snapshot is called, it significantly increases the 'Page Fault' count in my Task Manager. Now I see all my other programs that are running also have some of these 'Page Faults' too, but the app I wrote calls CreateToolhelp32Snapshot in a loop and so these 'Page Faults' add up very quickly to super high numbers.
Now I have researched a bit and I don't think there is anything too alarming about this, but some people who have used my program have criticized it for having this huge number of Page Faults...
So what I am trying to figure out is if this has anything to do with VB or if the CreateToolhelp32Snapshot will increase Page Faults in a C++ app too. I have narrowed it down to that exact call of CreateToolhelp32Snapshot, and once the snapshot is open there is no problem calling the other enumeration APIs (such as Process32First etc). And YES I am also calling CloseHandle on the snapshot after using it.
Can someone please try creating a simple C++ app that calls CreateToolhelp32Snapshot and check in your Task Manager to see if the Page Faults increase each time it's called (NOTE: the Page Faults tab is not visible by default, you have to go to the 'Processes' tab and then VIEW > SELECT COLUMNS... to add the Page Faults column).
If someone can run this quick test for me I would really appreciate it and it will help me know how to proceed if this is fixable. : )