[Solved] Dynamic memory allocation in game server [closed]


In the real world, dynamic allocation is slower than automatic allocation. That’s true — at least in general.

That doesn’t mean that dynamic allocation is too slow. The only way to determine that is to profile your code. Until you have done that, it is impossible to say that you should abandon dynamic allocation because it is too slow.

That’s not to say your choice to use dynamic allocation was the right choice. . There are reasons other than performance why dynamic allocation is often a dish best left unserved. You should understand the nature of memory allocation, the reasons to allocate memory in a particular way, and the pros and cons of each before settling on your design.

In C++, the default allocation method should usually be automatic allocation until you have a reason to use some other method.

There are a lot of “I heard this” and “I don’t think that” in your question. Software engineering isn’t about guessing and rumors. It’s about rigor and logic. Test your code. Identify bottlenecks. Fix problems that you know about.

solved Dynamic memory allocation in game server [closed]