Hacker News new | ask | show | jobs
by tkinom 38 days ago
Implemented my own specialized memory allocator 26+ yrs ago. (Y2K timeframe) Probably older than the most of the CMU students :-(

Use pre-allocated pools with array of indexes, free/allocation idx for alloc and free.

Con: Fixed pool size and fixed amount of memory can be allocated per pool.

Pro: constant cost operations per alloc/free via Atomic inc/dec of idx - no linklist tranversing ; Can be alloc in kernel space and free in user space (linux/QNX) and in multiple user processes when memory pools are in shmem; Run very will in SMP environment without any locks - all memory contentions were handled with atomic +/- alloc/free idx.

Same source code run in QNX, vxworks and linux (kernel and user space) at that time.