Re:Is C++ still needed?
by humbledrone on Wednesday August 19, 2009 @04:17PM
(#773678)
There's no way that real memory allocation is faster in C# than in C++. I don't know much about the CLR, but if it appears to allocate memory faster, it is probably because it is taking the memory from a pool which it has already allocated from the OS. You can do that in C++ if you want, using e.g. boost::pool.
[ Parent
| on HN ]
Re:Is C++ still needed?
by stonemetal on Monday August 24, 2009 @05:56PM
(#783484)
As with most compacting collecting languages memory allocation is a space check and a pointer increment. In C++ new has to do quite a bit more. It is about Java but C# is capable of the same.
http://www.ibm.com/developerworks/java/library/j-jtp09275.ht...
Also note that C++'s memory model is "single threaded" new must grab a global lock where as C#'s memory allocator is designed with threads in mind so no locking overhead.