{"id":13514851,"url":"https://github.com/SergeyMakeev/smmalloc","last_synced_at":"2025-03-31T03:31:34.579Z","repository":{"id":50426741,"uuid":"117236595","full_name":"SergeyMakeev/smmalloc","owner":"SergeyMakeev","description":"Blazing fast memory allocator designed for video games","archived":false,"fork":false,"pushed_at":"2023-10-13T17:32:07.000Z","size":1736,"stargazers_count":292,"open_issues_count":4,"forks_count":28,"subscribers_count":17,"default_branch":"master","last_synced_at":"2024-11-01T18:37:58.920Z","etag":null,"topics":["concurency","cpp","game-development","memory-allocator","multithreading"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SergeyMakeev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-01-12T12:05:37.000Z","updated_at":"2024-10-25T13:08:41.000Z","dependencies_parsed_at":"2023-10-14T16:40:15.701Z","dependency_job_id":"9db2311f-7846-4640-b5b5-18e861ffbcff","html_url":"https://github.com/SergeyMakeev/smmalloc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergeyMakeev%2Fsmmalloc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergeyMakeev%2Fsmmalloc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergeyMakeev%2Fsmmalloc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SergeyMakeev%2Fsmmalloc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SergeyMakeev","download_url":"https://codeload.github.com/SergeyMakeev/smmalloc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413377,"owners_count":20773053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concurency","cpp","game-development","memory-allocator","multithreading"],"created_at":"2024-08-01T05:01:02.707Z","updated_at":"2025-03-31T03:31:29.570Z","avatar_url":"https://github.com/SergeyMakeev.png","language":"C++","readme":"# smmalloc \n[![Actions Status](https://github.com/SergeyMakeev/smmalloc/workflows/build/badge.svg)](https://github.com/SergeyMakeev/smmalloc/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8c3oqiywaa8firfy?svg=true)](https://ci.appveyor.com/project/SergeyMakeev/smmalloc/) [![codecov](https://codecov.io/gh/SergeyMakeev/smmalloc/branch/master/graph/badge.svg?token=DKANC80IO5)](https://codecov.io/gh/SergeyMakeev/smmalloc) ![MIT](https://img.shields.io/badge/license-MIT-blue.svg)\n\n## About\n\nsmmalloc is a fast and efficient \"proxy\" allocator designed to handle many small allocations/deallocations in heavy multithreaded scenarios.\nThe allocator created for using in applications where the performance is critical such as video games.\nDesigned to speed up the typical memory allocation pattern in C++ such as many small allocations and deletions.\nThis is a proxy allocator means that smmalloc handles only specific allocation sizes and pass-through all other allocations to generic heap allocator.\n\n## Commercial games using smmalloc\n\n- Warface (PS4, X1, Nintendo Switch)\n\n\n## Features\n\n* Near zero size overhead for handled allocations (allocator does not store any per-allocation meta information)\n* Blazing fast (~40 cycles per operation) when allocator thread cache is used (configurable)\n* Very simple to integrate on any platform. Just make your current allocator as fallback allocator and let the smmalloc handle specific allocations and speed up your application.\n* Highly scalable in multithread environment.\n\n## Performance\n\nHere is an example of performance comparison for several different allocators.  \nPlatform: Windows 10, Intel Core i7-2600\n\nThreads | #1 | #2 | #3 | #4 | #5\n--- | --- | --- | --- |--- |---\ncrt | 23853865 | 15410410 | 15993655 | 14124607 | 14636381\nrpmalloc | 75866414 | 52689298 | 52606215 |46058909 | 38706739\nhoard | 65922032 | 46605339 | 42874516 | 34404618 | 27629651\nltalloc | 62525965 | 52315981 | 41634992 | 33557726 | 27333887\nsmmalloc | 92615384 | 70584046 | 66352324 | 47087501 | 38303161\nsmmalloc (no thread cache) | 49295774 | 25991465 | 11342809 | 8615216 | 6455889\ndlmalloc + mutex | 31313394 | 5858632 | 3824636 | 3354672 | 2135141\ndlmalloc | 106304079 | 0 | 0 | 0 | 0\n\n![Performance comparison](https://raw.githubusercontent.com/SergeyMakeev/smmalloc/master/Images/i7_results.png)\n\n\nHere is an example of performance comparison for several different allocators.  \nPlatform: Playstation 4\n\nThreads | #1 | #2 | #3 | #4\n--- | --- | --- | --- |--- \nmspace | 4741379 | 956729 | 457264 | 366920\ncrt | 4444444 | 853385 | 419009 | 332095\nltalloc | 28571429 | 25290698 | 19248174 | 14683637\nsmmalloc | 36065574 | 29333333 | 25202412 | 21868691\nsmmalloc (no thread cache)  | 22916667 | 8527132 | 5631815 | 4198497\ndlmalloc + mutex | 8058608 | 1848623 | 579845 | 564604\ndlmalloc | 35483871 | 0 | 0 | 0\n\n![Performance comparison](https://raw.githubusercontent.com/SergeyMakeev/smmalloc/master/Images/ps4_results.png)\n\n## Usage\n\n**_sm_allocator_create** - create allocator instance  \n**_sm_allocator_destroy** - destroy allocator instance  \n**_sm_allocator_thread_cache_create** - create thread cache for current thread  \n**_sm_allocator_thread_cache_destroy** - destroy thread cache for current thread  \n**_sm_malloc** - allocate aligned memory block  \n**_sm_free** - free memory block  \n**_sm_realloc** - reallocate memory block  \n**_sm_msize** - get usable memory size  \n\nTiny code example\n```cpp\n\n// create allocator to handle 16, 32, 48 and 64 allocations (4 buckets, 16Mb each) \nsm_allocator space = _sm_allocator_create(4, (16 * 1024 * 1024));\n\n// allocate 19 bytes with 16 bytes alignment\nvoid* p = _sm_malloc(space, 19, 16);\n\n// free memory\n_sm_free(space, p)\n\n// destroy allocator\n_sm_allocator_destroy(space);\n\n```\n","funding_links":[],"categories":["Embed-Script/VM/","C++"],"sub_categories":["Lua"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSergeyMakeev%2Fsmmalloc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSergeyMakeev%2Fsmmalloc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSergeyMakeev%2Fsmmalloc/lists"}