{"id":5004,"date":"2014-03-30T17:44:46","date_gmt":"2014-03-30T17:44:46","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/c-stl-with-jemalloc-collection-of-common-programming-errors\/"},"modified":"2014-03-30T17:44:46","modified_gmt":"2014-03-30T17:44:46","slug":"c-stl-with-jemalloc-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/c-stl-with-jemalloc-collection-of-common-programming-errors\/","title":{"rendered":"C++ STL with jemalloc-Collection of common programming errors"},"content":{"rendered":"<p>How is it possible to use C++ STL containers with jemalloc (or any other <code>malloc<\/code> implementation)?<\/p>\n<p>Is it as simple as include <code>jemalloc\/jemalloc.h<\/code>? Or should I write an allocator for them?<\/p>\n<p><strong>Edit<\/strong>: The application I&#8217;m working on allocates and frees relatively small objects over its lifetime. I want the replace the default allocator, because benchmarks showed that the application doesn&#8217;t scale beyond 2 cores. Profiling showed that it was waiting for memory allocation, that&#8217;s what caused the scaling issues. As I understand, <code>jemalloc<\/code> will help with that.<\/p>\n<p>I&#8217;d like to see a solution, that&#8217;s platform-neutral as the application has to work on both Linux and Windows. (Linking against a different implementation is easy under Linux, but it&#8217;s very hard on Windows as far as I know.)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How is it possible to use C++ STL containers with jemalloc (or any other malloc implementation)? Is it as simple as include jemalloc\/jemalloc.h? Or should I write an allocator for them? Edit: The application I&#8217;m working on allocates and frees relatively small objects over its lifetime. I want the replace the default allocator, because benchmarks [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5004","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5004","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5004"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5004\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5004"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5004"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5004"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}