From ad7258f68ce525845508fc0c4a329c282982ffa0 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 9 Aug 2023 12:15:54 +0200 Subject: new .internal_allocator configuration IUNTESTED) new configuration option .internal_allocator to help LuaJIT users. THIS IS YET UNTESTED, USE AT YOUR OWN RISKS. --- docs/index.html | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/index.html b/docs/index.html index 0e1a30b..b1c514d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -64,13 +64,13 @@


- Copyright © 2007-22 Asko Kauppi, Benoit Germain. All rights reserved. + Copyright © 2007-23 Asko Kauppi, Benoit Germain. All rights reserved.
Lua Lanes is published under the same MIT license as Lua 5.1, 5.2, 5.3 and 5.4.

- This document was revised on 8-Feb-22, and applies to version 3.16.0. + This document was revised on 9-Aug-23, and applies to version 3.16.1.

@@ -338,9 +338,9 @@ nil/"protected"/function - (Since v3.13.0)
- If nil, Lua states are created with lua_newstate() and reuse the allocator from the master state.
- If "protected", The default allocator obtained from lua_getallocf() in the master state is wrapped inside a critical section and used in all newly created states.
+ (Since v3.13.0)
+ If nil, Lua states are created with lua_newstate() and reuse the allocator from the master state.
+ If "protected", The default allocator obtained from lua_getallocf() in the master state is wrapped inside a critical section and used in all newly created states.
If a function, this function is called prior to creating the state. It should return a full userdata containing the following structure: @@ -355,6 +355,22 @@ + + + + + + -- cgit v1.2.3-55-g6feb
+ .internal_allocator + + "libc"/"allocator" + + (Since v3.16.1)
+ Controls which allocator is used for Lanest internal allocations (for keeper and deep userdata management). + If "libc", Lanes uses realloc and free.
+ If "allocator", Lanes uses whatever was obtained from the "allocator" setting.
+ This option is mostly useful for embedders that want control all memory allocations, but have issues when Lanes tries to use the Lua State allocator for internal purposes (especially with LuaJIT). +
.demote_full_userdata @@ -390,18 +406,18 @@ If provided, will be called in every created Lua state right after initializing the base libraries. -
+
Keeper states will call it as well, but only if it is a C function (keeper states are not able to execute any user Lua code). -
+
Typical usage is twofold:
  • Tweak package.loaders
  • Load some additional C functions in the global space (of course only a C function will be able to do this).
That way, all changes in the state can be properly taken into account when building the function lookup database. Default is nil. -
+
(Since version 3.7.6) If on_state_create() is a Lua function, it will be transfered normally before the call. -
+
If it is a C function, a C closure will be reconstructed in the created state from the C pointer. Lanes will raise an error if the function has upvalues.