All Projects → SergeyMakeev → Smmalloc

SergeyMakeev / Smmalloc

Licence: mit
Blazing fast memory allocator designed for video games

Programming Languages

cpp
1120 projects

Projects that are alternatives of or similar to Smmalloc

Taskscheduler
Cross-platform, fiber-based, multi-threaded task scheduler designed for video games.
Stars: ✭ 402 (+159.35%)
Mutual labels:  multithreading, game-development
Fpsgame
A primary FPS game developed by CPP,including real-time rendering,action processing,collision detection,keyboard response,etc.
Stars: ✭ 152 (-1.94%)
Mutual labels:  game-development
Zengine
2D | 3D Game development library
Stars: ✭ 145 (-6.45%)
Mutual labels:  game-development
Socket.io Client Unity3d
socket.io-Client for Unity3D, which is compatible with socket.io v1.x
Stars: ✭ 147 (-5.16%)
Mutual labels:  game-development
Fibry
The first Java Actor System supporting fibers from Project Loom
Stars: ✭ 146 (-5.81%)
Mutual labels:  multithreading
Cakelisp
Metaprogrammable, hot-reloadable, no-GC language for high perf programs (especially games), with seamless C/C++ interop
Stars: ✭ 149 (-3.87%)
Mutual labels:  game-development
B8
BASIC8 - The Fantasy Computer/Console!
Stars: ✭ 144 (-7.1%)
Mutual labels:  game-development
Simpleai
SimpleAI is a small C++ AI behaviour tree based library with a QT5 based remote debugger (and with optional LUA bindings) released under MIT.
Stars: ✭ 153 (-1.29%)
Mutual labels:  game-development
Jinx
Embeddable scripting language for real-time applications
Stars: ✭ 150 (-3.23%)
Mutual labels:  game-development
Mir2
Javascript+Easycanvas+Node实现热血传奇(Mir2)游戏,还原了人物&装备&刷怪&战斗&背包等功能,支持联机,详情见wiki。
Stars: ✭ 147 (-5.16%)
Mutual labels:  game-development
Cc Attack
Using Socks4/5 proxy to make a multithreading Http-flood/Https-flood (cc) attack.
Stars: ✭ 145 (-6.45%)
Mutual labels:  multithreading
Awesome Pico 8
A curated list of awesome PICO-8 resources, carts, tools and more
Stars: ✭ 1,955 (+1161.29%)
Mutual labels:  game-development
Sm
🚀 SM – a static State Machine library
Stars: ✭ 149 (-3.87%)
Mutual labels:  game-development
Masuit.tools
ldqk.xyz/55
Stars: ✭ 2,539 (+1538.06%)
Mutual labels:  multithreading
Cs libguarded
Header-only library for multithreaded programming
Stars: ✭ 151 (-2.58%)
Mutual labels:  multithreading
Taskchain
TaskChain Control Flow framework. Helps facilitate running tasks on an application's "Main Thread" (such as a game), and tasks off the main (async).
Stars: ✭ 143 (-7.74%)
Mutual labels:  game-development
Nevermoreengine
ModuleScript loader with reusable and easy unified server-client modules for faster game development on Roblox
Stars: ✭ 146 (-5.81%)
Mutual labels:  game-development
Tmx
C tmx map loader
Stars: ✭ 148 (-4.52%)
Mutual labels:  game-development
Swissarmylib
Collection of helpful utilities we use in our Unity projects.
Stars: ✭ 154 (-0.65%)
Mutual labels:  game-development
Mos
Lightweight game engine.
Stars: ✭ 153 (-1.29%)
Mutual labels:  game-development

About

smmalloc is a fast and efficient "proxy" allocator designed to handle many small allocations/deallocations in heavy multithreaded scenarios. The allocator created for using in applications where the performance is critical such as video games. Designed to speed up the typical memory allocation pattern in C++ such as many small allocations and deletions. This is a proxy allocator means that smmalloc handles only specific allocation sizes and pass-through all other allocations to generic heap allocator.

Build status

Windows Appveyor build status

Commercial games using smmalloc

  • Warface (PS4, X1, Nintendo Switch)

Features

  • Near zero size overhead for handled allocations (allocator does not store any per-allocation meta information)
  • Blazing fast (~40 cycles per operation) when allocator thread cache is used (configurable)
  • 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.
  • Highly scalable in multithread environment.

Performance

Here is an example of performance comparison for several different allocators.
Platform: Windows 10, Intel Core i7-2600

Threads #1 #2 #3 #4 #5
crt 23853865 15410410 15993655 14124607 14636381
rpmalloc 75866414 52689298 52606215 46058909 38706739
hoard 65922032 46605339 42874516 34404618 27629651
ltalloc 62525965 52315981 41634992 33557726 27333887
smmalloc 92615384 70584046 66352324 47087501 38303161
smmalloc (no thread cache) 49295774 25991465 11342809 8615216 6455889
dlmalloc + mutex 31313394 5858632 3824636 3354672 2135141
dlmalloc 106304079 0 0 0 0

Performance comparison

Here is an example of performance comparison for several different allocators.
Platform: Playstation 4

Threads #1 #2 #3 #4
mspace 4741379 956729 457264 366920
crt 4444444 853385 419009 332095
ltalloc 28571429 25290698 19248174 14683637
smmalloc 36065574 29333333 25202412 21868691
smmalloc (no thread cache) 22916667 8527132 5631815 4198497
dlmalloc + mutex 8058608 1848623 579845 564604
dlmalloc 35483871 0 0 0

Performance comparison

Usage

_sm_allocator_create - create allocator instance
_sm_allocator_destroy - destroy allocator instance
_sm_allocator_thread_cache_create - create thread cache for current thread
_sm_allocator_thread_cache_destroy - destroy thread cache for current thread
_sm_malloc - allocate aligned memory block
_sm_free - free memory block
_sm_realloc - reallocate memory block
_sm_msize - get usable memory size

Tiny code example

// create allocator to handle 16, 32, 48 and 64 allocations (4 buckets, 16Mb each) 
sm_allocator space = _sm_allocator_create(4, (16 * 1024 * 1024));

// allocate 19 bytes with 16 bytes alignment
void* p = _sm_malloc(space, 19, 16);

// free memory
_sm_free(space, p)

// destroy allocator
_sm_allocator_destroy(space);

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].