Davide Grohmann | 144b2d2 | 2022-05-31 15:24:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022 Arm Limited. |
| 3 | * |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the License); you may |
| 7 | * not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 14 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | */ |
| 18 | |
| 19 | #include "FreeRTOS.h" |
| 20 | #include <cstddef> |
| 21 | #include <new> |
| 22 | |
| 23 | void *operator new(size_t size) { |
| 24 | return pvPortMalloc(size); |
| 25 | } |
| 26 | |
| 27 | void *operator new[](size_t size) { |
| 28 | return pvPortMalloc(size); |
| 29 | } |
| 30 | |
Davide Grohmann | 244a9b8 | 2022-08-15 17:11:54 +0200 | [diff] [blame] | 31 | void operator delete(void *ptr) noexcept { |
Davide Grohmann | 144b2d2 | 2022-05-31 15:24:02 +0200 | [diff] [blame] | 32 | vPortFree(ptr); |
| 33 | } |
| 34 | |
Davide Grohmann | 244a9b8 | 2022-08-15 17:11:54 +0200 | [diff] [blame] | 35 | void operator delete(void *ptr, std::size_t) noexcept { |
Davide Grohmann | 144b2d2 | 2022-05-31 15:24:02 +0200 | [diff] [blame] | 36 | vPortFree(ptr); |
| 37 | } |
| 38 | |
Davide Grohmann | 244a9b8 | 2022-08-15 17:11:54 +0200 | [diff] [blame] | 39 | void operator delete[](void *ptr) noexcept { |
Davide Grohmann | 144b2d2 | 2022-05-31 15:24:02 +0200 | [diff] [blame] | 40 | vPortFree(ptr); |
| 41 | } |
| 42 | |
Davide Grohmann | 244a9b8 | 2022-08-15 17:11:54 +0200 | [diff] [blame] | 43 | void operator delete[](void *ptr, std::size_t) noexcept { |
Davide Grohmann | 144b2d2 | 2022-05-31 15:24:02 +0200 | [diff] [blame] | 44 | vPortFree(ptr); |
| 45 | } |