The Windows malloc() implementation from MSVCRT is slow
21–30 of 187 posts
Re: The Windows malloc() implementation from MSVCRT is slow
#22Re: The Windows malloc() implementation from MSVCRT is slow
#23Re: The Windows malloc() implementation from MSVCRT is slow
#24Re: The Windows malloc() implementation from MSVCRT is slow
#25If you're depending on the performance of malloc, you're either using the language incorrectly or using the wrong language. There is no such thing as a general purpose anything when you care about performance, there's only good enough. If you are 1) determined to stick with malloc and 2) want something predictable and better, then you are necessarily on the market for one of the alternatives to the system malloc anyw…
The whole point of the article, though, was that the system malloc was good enough on Linux and Darwin.
An over-dependence on malloc is one of the first places I look when optimizing old C++ codebases, even on Linux and Darwin. Degradation on Linux + macOS is still there, but more insidious because the default is so good that simple apps don't see it.
Re: The Windows malloc() implementation from MSVCRT is slow
#26Has everyone forgotten that Unix is the common ancestor of Linux and every other Unixlike? I’m seeing an uptick of people writing nonsensical comments like “this was written for Linux (or Mac OS X, which implements POSIX and is therefore really Linux in drag)”.
Re: The Windows malloc() implementation from MSVCRT is slow
#27There is no Windows malloc(). Only UNIXes have the C API as part of the OS API.
Re: The Windows malloc() implementation from MSVCRT is slow
#28Well... Who told you to link to MSVCRT (the one in System32)? Not Microsoft that's for sure. New software is supposed to link to the Visual Studio C runtime it was compiled with and then ship that library alongside the application itself. Even if you don't compile with VS you can distribute the runtime library (freely downloadable from some page on microsoft.com). Ostensibly, that library contains an efficient malloc…
Microsoft refer to the modern libraries as the "Microsoft C and C++ (MSVC) runtime libraries", so shortening that to MSVCRT doesn't seem unreasonable.
Re: The Windows malloc() implementation from MSVCRT is slow
#29Well... Who told you to link to MSVCRT (the one in System32)? Not Microsoft that's for sure. New software is supposed to link to the Visual Studio C runtime it was compiled with and then ship that library alongside the application itself. Even if you don't compile with VS you can distribute the runtime library (freely downloadable from some page on microsoft.com). Ostensibly, that library contains an efficient malloc…
Re: The Windows malloc() implementation from MSVCRT is slow
#30I wonder how much of this is the development culture at MS. https://www.theregister.com/2022/05/10/jeffrey_snover_said_m... (“When I was doing the prototype for what became PowerShell, a friend cautioned me saying that was the sort of thing that got people fired.”) In that environment I can imagine nobody wants to be on the hook for messing with something fundamental like malloc(). The complete trash fire that is O36…