summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/netlist/plib/pdynlib.cpp
diff options
context:
space:
mode:
author couriersud <couriersud@gmx.org>2019-02-21 22:59:17 +0100
committer couriersud <couriersud@gmx.org>2019-02-22 08:18:01 +0100
commitcf73ccc764d574284bef4ce95ee5bc3e9089f053 (patch)
tree1655c2836b200c90d5fe5dd5833159e7e8be1522 /src/lib/netlist/plib/pdynlib.cpp
parent6ed352261d40e37887357fe901dc380d6ef79844 (diff)
netlist: memory management. [Couriersud]
Memory management in plib is now alignment-aware. All allocations respect c++11 alignas. Selected classes like parray and aligned_vector also provide hints (__builtin_assume_aligned) to g++ and clang. The alignment optimizations have little impact on the current use cases. They only become effective on bigger data processing. What has a measurable impact is memory pooling. This speeds up netlist games like breakout and pong by about 5%. Tested with linux, macosx and windows cross builds. All features are disabled since I can not rule out they may temporarily break more exotic builds.
Diffstat (limited to 'src/lib/netlist/plib/pdynlib.cpp')
-rw-r--r--src/lib/netlist/plib/pdynlib.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/netlist/plib/pdynlib.cpp b/src/lib/netlist/plib/pdynlib.cpp
index f30ddc5d59a..c0c89de208d 100644
--- a/src/lib/netlist/plib/pdynlib.cpp
+++ b/src/lib/netlist/plib/pdynlib.cpp
@@ -25,7 +25,7 @@ CHAR *astring_from_utf8(const char *utf8string)
// convert UTF-16 to "ANSI code page" string
char_count = WideCharToMultiByte(CP_ACP, 0, wstring, -1, nullptr, 0, nullptr, nullptr);
- result = palloc_array<CHAR>(char_count);
+ result = pnew_array<CHAR>(char_count);
if (result != nullptr)
WideCharToMultiByte(CP_ACP, 0, wstring, -1, result, char_count, nullptr, nullptr);
@@ -39,7 +39,7 @@ WCHAR *wstring_from_utf8(const char *utf8string)
// convert MAME string (UTF-8) to UTF-16
char_count = MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, nullptr, 0);
- result = palloc_array<WCHAR>(char_count);
+ result = pnew_array<WCHAR>(char_count);
if (result != nullptr)
MultiByteToWideChar(CP_UTF8, 0, utf8string, -1, result, char_count);
@@ -72,7 +72,7 @@ dynlib::dynlib(const pstring libname)
m_isLoaded = true;
//else
// fprintf(stderr, "win: library <%s> not found!\n", libname.c_str());
- pfree_array(buffer);
+ pdelete_array(buffer);
#elif defined(EMSCRIPTEN)
//no-op
#else
@@ -106,7 +106,7 @@ dynlib::dynlib(const pstring path, const pstring libname)
{
//printf("win: library <%s> not found!\n", libname.c_str());
}
- pfree_array(buffer);
+ pdelete_array(buffer);
#elif defined(EMSCRIPTEN)
//no-op
#else