Skip to content

Commit 251cdd8

Browse files
committed
Update base for Update on "[Executorch] Make module constructors uniform across"
Existing constructors dont compose well such that if you want data loader or data files constructor then you cannot get to override memory allocator. Fix that. Differential Revision: [D86120037](https://our.internmc.facebook.com/intern/diff/D86120037/) [ghstack-poisoned]
1 parent 989846e commit 251cdd8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

extension/memory_allocator/cpu_caching_malloc_allocator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ void* CPUCachingAllocator::allocate(size_t size, size_t alignment) {
1919
return nullptr;
2020
}
2121
alignment = std::max(alignment, kCachingAllocatorDefaultAlignment);
22-
size_t adjusted_size = executorch::extension::utils::get_aligned_size(size, alignment);
22+
size_t adjusted_size =
23+
executorch::extension::utils::get_aligned_size(size, alignment);
2324
if (adjusted_size == 0) {
2425
return nullptr;
2526
}

extension/memory_allocator/memory_allocator_utils.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ inline size_t get_aligned_size(size_t size, size_t alignment) {
2727
// this is the only portable way to get aligned memory from the heap.
2828
const size_t extra = alignment - 1;
2929
if ET_UNLIKELY (extra >= SIZE_MAX - size) {
30-
ET_LOG(
31-
Error, "Malloc size overflow: size=%zu + extra=%zu", size, extra);
30+
ET_LOG(Error, "Malloc size overflow: size=%zu + extra=%zu", size, extra);
3231
return 0;
3332
}
3433
size += extra;

0 commit comments

Comments
 (0)