| 1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
| 2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
| 3 | #pragma once |
| 4 | |
| 5 | namespace bs |
| 6 | { |
| 7 | /** @addtogroup Internal-Utility |
| 8 | * @{ |
| 9 | */ |
| 10 | |
| 11 | /** @addtogroup Memory-Internal |
| 12 | * @{ |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * Free allocator with no limitations, using traditional malloc/free under the hood. */ |
| 17 | class FreeAlloc |
| 18 | { |
| 19 | public: |
| 20 | /** Allocates memory. */ |
| 21 | UINT8* alloc(UINT32 amount) |
| 22 | { |
| 23 | return (UINT8*)malloc(amount); |
| 24 | } |
| 25 | |
| 26 | /** Deallocates a previously allocated piece of memory. */ |
| 27 | void free(void* data) |
| 28 | { |
| 29 | ::free(data); |
| 30 | } |
| 31 | |
| 32 | /** Unused */ |
| 33 | void clear() |
| 34 | { |
| 35 | // Do nothing |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | /** @} */ |
| 40 | /** @} */ |
| 41 | } |
| 42 | |