murrayju / CreateProcessAsUser

Creates a process in a different Windows session
MIT License
369 stars 114 forks source link

Memory Leak in GetSessionUserToken #5

Closed FrankGrimesy closed 10 months ago

FrankGrimesy commented 9 years ago

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

skelley187 commented 7 years ago

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.

AndrewSav commented 7 years ago

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.

MV10 commented 10 months ago

@murrayju This can be closed.

murrayju commented 10 months ago

Fixed in #37.