From 881337ca41ba6f07bf50b90cbd0dcba30fa010fe Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 1 Jan 2021 01:59:36 +0100 Subject: [PATCH] Allocate memory for storing plugins on the default heap --- source/plugin/PluginData.cpp | 5 +++-- source/plugin/PluginDataFactory.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/plugin/PluginData.cpp b/source/plugin/PluginData.cpp index ac20e85..ffd066c 100644 --- a/source/plugin/PluginData.cpp +++ b/source/plugin/PluginData.cpp @@ -41,7 +41,7 @@ PluginData::PluginData(const std::vector& input, MEMHeapHandle heapHand default: case eMemTypeExpHeap: data_copy = MEMAllocFromExpHeapEx(heapHandle, length, 4); - DEBUG_FUNCTION_LINE("Allocated %d kb from ExpHeap", length / 1024); + DEBUG_FUNCTION_LINE("Allocated %d kb on ExpHeap", length / 1024); if (data_copy == nullptr) { DEBUG_FUNCTION_LINE("Failed to allocate space on exp heap"); } else { @@ -51,7 +51,8 @@ PluginData::PluginData(const std::vector& input, MEMHeapHandle heapHand DEBUG_FUNCTION_LINE("copied data to exp heap"); break; case eMemTypeMEM2: - data_copy = memalign(length, 4); + data_copy = memalign(4, length); + DEBUG_FUNCTION_LINE("Allocated %d kb on default heap", length / 1024); if (data_copy == nullptr) { DEBUG_FUNCTION_LINE("Failed to allocate space on default heap"); } else { diff --git a/source/plugin/PluginDataFactory.cpp b/source/plugin/PluginDataFactory.cpp index d29d345..af4e7b1 100644 --- a/source/plugin/PluginDataFactory.cpp +++ b/source/plugin/PluginDataFactory.cpp @@ -98,6 +98,6 @@ std::optional PluginDataFactory::load(std::vector &buffer, return std::nullopt; } - PluginData pluginData(buffer, heapHandle, eMemoryTypes::eMemTypeExpHeap); + PluginData pluginData(buffer, heapHandle, eMemoryTypes::eMemTypeMEM2); return pluginData; }