Allocate memory for storing plugins on the default heap

This commit is contained in:
Maschell 2021-01-01 01:59:36 +01:00
parent ec443161af
commit 881337ca41
2 changed files with 4 additions and 3 deletions

View File

@ -41,7 +41,7 @@ PluginData::PluginData(const std::vector<uint8_t>& input, MEMHeapHandle heapHand
default: default:
case eMemTypeExpHeap: case eMemTypeExpHeap:
data_copy = MEMAllocFromExpHeapEx(heapHandle, length, 4); 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) { if (data_copy == nullptr) {
DEBUG_FUNCTION_LINE("Failed to allocate space on exp heap"); DEBUG_FUNCTION_LINE("Failed to allocate space on exp heap");
} else { } else {
@ -51,7 +51,8 @@ PluginData::PluginData(const std::vector<uint8_t>& input, MEMHeapHandle heapHand
DEBUG_FUNCTION_LINE("copied data to exp heap"); DEBUG_FUNCTION_LINE("copied data to exp heap");
break; break;
case eMemTypeMEM2: 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) { if (data_copy == nullptr) {
DEBUG_FUNCTION_LINE("Failed to allocate space on default heap"); DEBUG_FUNCTION_LINE("Failed to allocate space on default heap");
} else { } else {

View File

@ -98,6 +98,6 @@ std::optional<PluginData> PluginDataFactory::load(std::vector<uint8_t> &buffer,
return std::nullopt; return std::nullopt;
} }
PluginData pluginData(buffer, heapHandle, eMemoryTypes::eMemTypeExpHeap); PluginData pluginData(buffer, heapHandle, eMemoryTypes::eMemTypeMEM2);
return pluginData; return pluginData;
} }