HDTutorial
EN

Playback starts YouTube’s embedded player (privacy-enhanced mode).

Custom Allocator Tutorial - How-To

23,854 views October 28, 2016 25:37

Watch on YouTube
ChannelCode Blacksmith

Description from the creator

Allocators are objects responsible for encapsulating memory management. They are used all around the Standard Library, particularly STL. By default, the standard classes, like containers, smart pointers, etc., use a default allocator, which is simply a std::allocator. The purpose of such entity is to abstract away all the details about low-level memory operations, but also provide some meta information about the type they are responsible of managing. The default allocator simply uses the operators new and delete to obtain and release memory, so it’s a simple wrapper around standard C++ memory operations. So, why would someone want to make their own? Let’s assume we want to track how much memory our containers used for statistical reasons. Ok, let’s build a tracking allocator.

Source code: pastebin.com/XiwGBmu4

About this tutorial

Code Blacksmith published this 25:37 video tutorial on October 28, 2016. It has been watched 23,854 times on YouTube.

Duration
25:37
Published
October 28, 2016
Views
23,854
Likes
673

Tags

Share

This tutorial in other languages