Live data from Hacker News

Finding a VS Code Memory Leak

randomascii.wordpress.com

1–10 of 20 posts

Re: Finding a VS Code Memory Leak

#5
> Sometimes I think it would be nice to have limits on resources in order to more automatically find mistakes like this

I was actually fairly disappointed when Visual Studio (not code) went to 64-bit. Because I knew its memory usage was now going to be unconstrained. Still way better than the unapologetic gluttony of Rider but experiences showed it to be a bit leaky over time (tip: Ctrl-Alt-Shift-F12 twice does a full garbage collection https://learn.microsoft.com/en-us/visualstudio/ide/visual-st...)

Also remember that all your references (pointers) are going to double in size so right off the bat it will use more, potentially a lot more depending on how reference-heavy your data is

Re: Finding a VS Code Memory Leak

#9
post #7

Re the last wish, isn't that exactly what ulimit is for?

On Linux, yes, but this was Windows-specific code and Windows has no equivalent mechanism to ulimits.

There are job objects which are similar to Linux cgroups, including the ability to set a limit on the number of processes. But I'm not sure if that limit will be tripped in this case or not because the child processes have exited, whereas the job object parameter is specifically called LIMIT_ACTIVE_PROCESS

https://learn.microsoft.com/en-us/windows/win32/procthread/j...

https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns...

Re: Finding a VS Code Memory Leak

#10
post #9
post #7

Earlier quoted context omitted.

On Linux, yes, but this was Windows-specific code and Windows has no equivalent mechanism to ulimits.

There are job objects which are similar to Linux cgroups, including the ability to set a limit on the number of processes. But I'm not sure if that limit will be tripped in this case or not because the child processes have exited, whereas the job object parameter is specifically called LIMIT_ ACTIVE _PROCESS https://learn.microsoft.com/en-us/windows/win32/procthread/j... https://learn.microsoft.com/en-us/windows/win3…

OpenProcess retrieves a handle to an existing process rather than creating a process so it won't be governed by JOB_OBJECT_LIMIT_ACTIVE_PROCESS, the bug here is that it's leaking handles, not processes.
Post reply on HN