Skip to content

Commit 9b4b64c

Browse files
committed
[utils] Deprecate allocator::Dynamic for std::allocator
1 parent 5fcd015 commit 9b4b64c

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/modm/communication/rpr/interface.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <modm/architecture/utils.hpp>
1919
#include <modm/container/queue.hpp>
2020
#include <modm/processing/timer.hpp>
21-
#include <modm/utils/allocator/dynamic.hpp>
21+
#include <memory>
2222

2323
#include "constants.hpp"
2424

@@ -123,7 +123,7 @@ namespace modm
123123
static Queue messagesToSend;
124124
static Queue receivedMessages;
125125

126-
static modm::allocator::Dynamic<uint8_t> bufferAllocator;
126+
static std::allocator<uint8_t> bufferAllocator;
127127

128128
static Message receiveBuffer;
129129
static uint8_t rx_buffer[N+8];

src/modm/communication/rpr/interface_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ modm::rpr::Interface<Device, N>::popMessage(Queue &queue)
472472
// deallocate the external buffer
473473
Message message = queue.get();
474474
MODM_RPR_LOG("deallocating");
475-
bufferAllocator.deallocate(message.payload);
475+
bufferAllocator.deallocate(message.payload, message.length);
476476
// then remove the rest
477477
queue.pop();
478478
}

src/modm/container/module.lb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ def init(module):
2020
def prepare(module, options):
2121
module.depends(
2222
":architecture",
23-
":io",
24-
":utils")
23+
":io")
2524
return True
2625

2726

src/modm/utils/allocator.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
namespace modm::allocator
2020
{
2121

22+
// DEPRECATED: 2025q3
2223
/**
2324
* Base class for all allocator types
2425
*
@@ -66,6 +67,7 @@ class AllocatorBase
6667
}
6768
};
6869

70+
// DEPRECATED: 2025q3
6971
/**
7072
* Dynamic memory allocator
7173
*
@@ -76,7 +78,8 @@ class AllocatorBase
7678
* @author Fabian Greif
7779
*/
7880
template <typename T>
79-
class Dynamic : public AllocatorBase<T>
81+
class [[deprecated("Please use std::allocator<T> instead!")]]
82+
Dynamic : public AllocatorBase<T>
8083
{
8184
public:
8285
template <typename U>

0 commit comments

Comments
 (0)