5 ms·
Why do you have that impression? That makes very little sense to do - every single project? Don't you think someone would have released a library to implement
by ars 15y ago
Why do you have that impression?
That makes very little sense to do - every single project? Don't you think someone would have released a library to implement the "new and improved allocator" if everyone needs to use it?
- vilya 15y agoThat has been borne out by my experience so far too. There have been several successful efforts at writing better performing general-purpose allocators: * TCMalloc (http://goog-perftools.sourceforge.net/doc/tcmalloc.html) * jemalloc (http://www.canonware.com/jemalloc/) There's a great Facebook Engineering blog post about jemalloc which describes why a fast allocator is needed & why the standard malloc is not always sufficient: https://www.facebook.com/notes/facebook-engineering/scalable-memory-allocation-using-jemalloc/480222803919 https://www.facebook.com/notes/facebook-engineering/scalable...
- forrestthewoods 15y agoI've worked with several projects where a TCMalloc based allocator (threaded) was used to great success. A simple switch to DLMalloc (non-threaded) can also provide a significant performance boost. Moderate usage of STL can do nasty, nasty things to memory performance. In one case a game I worked on ran at 5-10fps and a simple, fast change to DLMalloc instantly took perf to 60fps.
- caf 15y agoIt's worth noting that at least on some platforms the system malloc is dlmalloc (presuming that DL is Doug Lea).
- vetler 15y ago+1 for TCMalloc. We used TCMalloc at Opera Community[0], and they still might be using it there for all I know ... it greatly improved performance on our MySQL servers! [0]: http://my.opera.com/ http://my.opera.com/
- anaisbetts 15y agoMost game projects do end up having to write a custom allocator, due to very specific memory budgets, deterministic malloc/free perf requirements, and issues with fragmentation.
- danssig 15y agoNo, the point of a custom allocator is writing one that works with your specific requirements. A general allocator will never be more efficient than a custom one designed for the specific task. It becomes just an issue of is the cost worth what the optimization buys you, and games are an area where you need every drop of speed you can get.