diff options
| author | Stefan Boberg <[email protected]> | 2024-11-19 09:59:04 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-11-19 09:59:04 +0100 |
| commit | e335ca10a6c6a1e37b155e2155f5c5908c0272ae (patch) | |
| tree | 78b32384df0e58b22052dcfa7990c16921c6b650 /src/zencore/iobuffer.cpp | |
| parent | 5.5.12 (diff) | |
| download | zen-e335ca10a6c6a1e37b155e2155f5c5908c0272ae.tar.xz zen-e335ca10a6c6a1e37b155e2155f5c5908c0272ae.zip | |
memory/string support cleanup and additions (#220)
* removed unused memory classes
* added align.h alignment helpers used in upcoming changes
* added char16_t StringLength
* avoid memory alloc in SetCurrentThreadName
* added command line parsing helpers to zencore/commandline.h
* removed IoBuffer direct VirtualAlloc path
Diffstat (limited to 'src/zencore/iobuffer.cpp')
| -rw-r--r-- | src/zencore/iobuffer.cpp | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/zencore/iobuffer.cpp b/src/zencore/iobuffer.cpp index 604cd90d6..51f380c34 100644 --- a/src/zencore/iobuffer.cpp +++ b/src/zencore/iobuffer.cpp @@ -43,20 +43,6 @@ namespace zen { void IoBufferCore::AllocateBuffer(size_t InSize, size_t Alignment) const { -#if ZEN_PLATFORM_WINDOWS - if (((InSize & 0xffFF) == 0) && (Alignment == 0x10000)) - { - m_Flags.fetch_or(kLowLevelAlloc, std::memory_order_relaxed); - void* Ptr = VirtualAlloc(nullptr, InSize, MEM_COMMIT, PAGE_READWRITE); - if (!Ptr) - { - ThrowLastError(fmt::format("VirtualAlloc failed for {:#x} bytes aligned to {:#x}", InSize, Alignment)); - } - m_DataPtr = Ptr; - return; - } -#endif // ZEN_PLATFORM_WINDOWS - #if ZEN_USE_MIMALLOC void* Ptr = mi_aligned_alloc(Alignment, RoundUp(InSize, Alignment)); m_Flags.fetch_or(kIoBufferAlloc, std::memory_order_relaxed); @@ -80,14 +66,6 @@ IoBufferCore::FreeBuffer() } const uint32_t LocalFlags = m_Flags.load(std::memory_order_relaxed); -#if ZEN_PLATFORM_WINDOWS - if (LocalFlags & kLowLevelAlloc) - { - VirtualFree(const_cast<void*>(m_DataPtr), 0, MEM_DECOMMIT); - - return; - } -#endif // ZEN_PLATFORM_WINDOWS #if ZEN_USE_MIMALLOC if (LocalFlags & kIoBufferAlloc) |