aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lanes.c')
-rw-r--r--src/lanes.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/src/lanes.c b/src/lanes.c
index 9f6a4d6..0aab244 100644
--- a/src/lanes.c
+++ b/src/lanes.c
@@ -253,15 +253,10 @@ static void lane_cleanup( Lane* s)
253 } 253 }
254#endif // HAVE_LANE_TRACKING() 254#endif // HAVE_LANE_TRACKING()
255 255
256 // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly
257#if USE_LUA_STATE_ALLOCATOR()
258 { 256 {
259 AllocatorDefinition* const allocD = &s->U->protected_allocator.definition; 257 AllocatorDefinition* const allocD = &s->U->internal_allocator;
260 allocD->allocF(allocD->allocUD, s, sizeof(Lane), 0); 258 allocD->allocF(allocD->allocUD, s, sizeof(Lane), 0);
261 } 259 }
262#else // USE_LUA_STATE_ALLOCATOR()
263 free(s);
264#endif // USE_LUA_STATE_ALLOCATOR()
265} 260}
266 261
267/* 262/*
@@ -584,7 +579,7 @@ static int selfdestruct_gc( lua_State* L)
584 U->timer_deep = NULL; 579 U->timer_deep = NULL;
585 } 580 }
586 581
587 close_keepers( U, L); 582 close_keepers( U);
588 583
589 // remove the protected allocator, if any 584 // remove the protected allocator, if any
590 cleanup_allocator_function( U, L); 585 cleanup_allocator_function( U, L);
@@ -1231,15 +1226,10 @@ LUAG_FUNC( lane_new)
1231 // 1226 //
1232 // a Lane full userdata needs a single uservalue 1227 // a Lane full userdata needs a single uservalue
1233 ud = lua_newuserdatauv( L, sizeof( Lane*), 1); // func libs priority globals package required gc_cb lane 1228 ud = lua_newuserdatauv( L, sizeof( Lane*), 1); // func libs priority globals package required gc_cb lane
1234 // don't hijack the state allocator when running LuaJIT because it looks like LuaJIT does not expect it and might invalidate the memory unexpectedly
1235#if USE_LUA_STATE_ALLOCATOR()
1236 { 1229 {
1237 AllocatorDefinition* const allocD = &U->protected_allocator.definition; 1230 AllocatorDefinition* const allocD = &U->internal_allocator;
1238 s = *ud = (Lane*)allocD->allocF(allocD->allocUD, NULL, 0, sizeof(Lane)); 1231 s = *ud = (Lane*)allocD->allocF(allocD->allocUD, NULL, 0, sizeof(Lane));
1239 } 1232 }
1240#else // USE_LUA_STATE_ALLOCATOR()
1241 s = *ud = (Lane*) malloc(sizeof(Lane));
1242#endif // USE_LUA_STATE_ALLOCATOR()
1243 if( s == NULL) 1233 if( s == NULL)
1244 { 1234 {
1245 return luaL_error( L, "could not create lane: out of memory"); 1235 return luaL_error( L, "could not create lane: out of memory");