Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'source/core')
-rw-r--r--source/core/CMakeLists.txt8
-rw-r--r--source/core/StarLua.cpp2
-rw-r--r--source/core/StarMemory.cpp19
3 files changed, 27 insertions, 2 deletions
diff --git a/source/core/CMakeLists.txt b/source/core/CMakeLists.txt
index bbad6f4..ce35500 100644
--- a/source/core/CMakeLists.txt
+++ b/source/core/CMakeLists.txt
@@ -214,4 +214,10 @@ ELSEIF (STAR_SYSTEM_FAMILY_WINDOWS)
ENDIF ()
ADD_LIBRARY (star_core OBJECT ${star_core_SOURCES} ${star_core_HEADERS})
-TARGET_PRECOMPILE_HEADERS (star_core PUBLIC StarPch.hpp) \ No newline at end of file
+TARGET_PRECOMPILE_HEADERS (star_core PUBLIC StarPch.hpp)
+
+IF(STAR_USE_JEMALLOC AND JEMALLOC_IS_PREFIXED)
+ SET_SOURCE_FILES_PROPERTIES(StarMemory.cpp PROPERTIES
+ COMPILE_DEFINITIONS STAR_JEMALLOC_IS_PREFIXED
+ )
+ENDIF() \ No newline at end of file
diff --git a/source/core/StarLua.cpp b/source/core/StarLua.cpp
index 84e6c82..b5e6b8a 100644
--- a/source/core/StarLua.cpp
+++ b/source/core/StarLua.cpp
@@ -1142,7 +1142,7 @@ LuaFunction LuaEngine::createRawFunction(lua_CFunction function) {
LuaFunction LuaEngine::createFunctionFromSource(int handleIndex, char const* contents, size_t size, char const* name) {
lua_checkstack(m_state, 2);
- handleError(m_state, luaL_loadbuffer(m_state, contents, size, name));
+ handleError(m_state, luaL_loadbufferx(m_state, contents, size, name, "t"));
pushHandle(m_state, handleIndex);
lua_setupvalue(m_state, -2, 1);
diff --git a/source/core/StarMemory.cpp b/source/core/StarMemory.cpp
index 3855283..9e73eb6 100644
--- a/source/core/StarMemory.cpp
+++ b/source/core/StarMemory.cpp
@@ -7,6 +7,7 @@
namespace Star {
#ifdef STAR_USE_JEMALLOC
+#ifdef STAR_JEMALLOC_IS_PREFIXED
void* malloc(size_t size) {
return je_malloc(size);
}
@@ -33,6 +34,24 @@ namespace Star {
}
void free(void* ptr) {
+ ::free(ptr);
+ }
+
+ void free(void* ptr, size_t size) {
+ if (ptr)
+ ::sdallocx(ptr, size, 0);
+ }
+#endif
+#else
+ void* malloc(size_t size) {
+ return ::malloc(size);
+ }
+
+ void* realloc(void* ptr, size_t size) {
+ return ::realloc(ptr, size);
+ }
+
+ void free(void* ptr) {
return ::free(ptr);
}