CreateProcessAsUser icon indicating copy to clipboard operation
CreateProcessAsUser copied to clipboard

Memory Leak in GetSessionUserToken

Open FrankGrimesy opened this issue 10 years ago • 2 comments

WTSEnumerateSessions parameter ppSessionInfo must be freed by WTSFreeMemory.

See: https://msdn.microsoft.com/en-us/library/aa383833(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/aa383834(v=vs.85).aspx

FrankGrimesy avatar Sep 10 '15 08:09 FrankGrimesy

I see where my service is using this and the mem usage is growing after every cycle but, after looking and the c++ code examples how would this be fixed in the c# code. This was a huge help but if the service I created is just going to keep using more and more memory I will have to restart it weekly and I would rather fix the code to release the unneeded memory than recycling the service.

skelley187 avatar Apr 18 '17 17:04 skelley187

how would this be fixed in the c# code

It looks, like the topic starter hits the nail on the head - it can be fixed by calling WTSFreeMemory

I would rather fix the code to release the unneeded memory than recycling the service

Yep, that would be great if you could to that. Please share the result, preferably in the form of pull request.

AndrewSav avatar Apr 18 '17 20:04 AndrewSav

@murrayju This can be closed.

MV10 avatar Dec 16 '23 11:12 MV10

Fixed in #37.

murrayju avatar Dec 21 '23 20:12 murrayju