diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2023-08-09 12:15:54 +0200 |
---|---|---|
committer | Benoit Germain <bnt.germain@gmail.com> | 2023-08-09 12:15:54 +0200 |
commit | e311963424b9f4756a98acfd1bf59677cbcfe646 (patch) | |
tree | 1634d050489561bdf20a27aa82df133ea361c120 | |
parent | 8b1ba14a1acd14d9723e8436920840c465e682ca (diff) | |
download | lanes-e311963424b9f4756a98acfd1bf59677cbcfe646.tar.gz lanes-e311963424b9f4756a98acfd1bf59677cbcfe646.tar.bz2 lanes-e311963424b9f4756a98acfd1bf59677cbcfe646.zip |
new .internal_allocator configuration IUNTESTED)
new configuration option .internal_allocator to help LuaJIT users. THIS IS YET UNTESTED, USE AT YOUR OWN RISKS.
-rw-r--r-- | index.html | 34 |
1 files changed, 25 insertions, 9 deletions
@@ -64,13 +64,13 @@ | |||
64 | <font size="-1"> | 64 | <font size="-1"> |
65 | <p> | 65 | <p> |
66 | <br/> | 66 | <br/> |
67 | <i>Copyright © 2007-22 Asko Kauppi, Benoit Germain. All rights reserved.</i> | 67 | <i>Copyright © 2007-23 Asko Kauppi, Benoit Germain. All rights reserved.</i> |
68 | <br/> | 68 | <br/> |
69 | Lua Lanes is published under the same <a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a> as Lua 5.1, 5.2, 5.3 and 5.4. | 69 | Lua Lanes is published under the same <a href="http://en.wikipedia.org/wiki/MIT_License">MIT license</a> as Lua 5.1, 5.2, 5.3 and 5.4. |
70 | </p> | 70 | </p> |
71 | 71 | ||
72 | <p> | 72 | <p> |
73 | This document was revised on 8-Feb-22, and applies to version <tt>3.16.0</tt>. | 73 | This document was revised on 9-Aug-23, and applies to version <tt>3.16.1</tt>. |
74 | </p> | 74 | </p> |
75 | </font> | 75 | </font> |
76 | </center> | 76 | </center> |
@@ -338,9 +338,9 @@ | |||
338 | <tt>nil</tt>/<tt>"protected"</tt>/function | 338 | <tt>nil</tt>/<tt>"protected"</tt>/function |
339 | </td> | 339 | </td> |
340 | <td> | 340 | <td> |
341 | (Since v3.13.0)<br/> | 341 | (Since v3.13.0)<br /> |
342 | If <tt>nil</tt>, Lua states are created with <tt>lua_newstate()</tt> and reuse the allocator from the master state.<br/> | 342 | If <tt>nil</tt>, Lua states are created with <tt>lua_newstate()</tt> and reuse the allocator from the master state.<br /> |
343 | If <tt>"protected"</tt>, The default allocator obtained from <tt>lua_getallocf()</tt> in the master state is wrapped inside a critical section and used in all newly created states.<br/> | 343 | If <tt>"protected"</tt>, The default allocator obtained from <tt>lua_getallocf()</tt> in the master state is wrapped inside a critical section and used in all newly created states.<br /> |
344 | If a <tt>function</tt>, this function is called prior to creating the state. It should return a full userdata containing the following structure: | 344 | If a <tt>function</tt>, this function is called prior to creating the state. It should return a full userdata containing the following structure: |
345 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> | 345 | <table border="1" bgcolor="#E0E0FF" cellpadding="10" style="width:50%"> |
346 | <tr> | 346 | <tr> |
@@ -356,6 +356,22 @@ | |||
356 | </tr> | 356 | </tr> |
357 | 357 | ||
358 | <tr valign=top> | 358 | <tr valign=top> |
359 | <td id="internal_allocator"> | ||
360 | <code>.internal_allocator</code> | ||
361 | </td> | ||
362 | <td> | ||
363 | <tt>"libc"</tt>/<tt>"allocator"</tt> | ||
364 | </td> | ||
365 | <td> | ||
366 | (Since v3.16.1)<br /> | ||
367 | Controls which allocator is used for Lanest internal allocations (for keeper and deep userdata management). | ||
368 | If <tt>"libc"</tt>, Lanes uses <tt>realloc</tt> and <tt>free</tt>.<br /> | ||
369 | If <tt>"allocator"</tt>, Lanes uses whatever was obtained from the <tt>"allocator"</tt> setting.<br /> | ||
370 | 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). | ||
371 | </td> | ||
372 | </tr> | ||
373 | |||
374 | <tr valign=top> | ||
359 | <td id="demote_full_userdata"> | 375 | <td id="demote_full_userdata"> |
360 | <code>.demote_full_userdata</code> | 376 | <code>.demote_full_userdata</code> |
361 | </td> | 377 | </td> |
@@ -390,18 +406,18 @@ | |||
390 | </td> | 406 | </td> |
391 | <td> | 407 | <td> |
392 | If provided, will be called in every created Lua state right after initializing the base libraries. | 408 | If provided, will be called in every created Lua state right after initializing the base libraries. |
393 | <br/> | 409 | <br /> |
394 | 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). | 410 | 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). |
395 | <br/> | 411 | <br /> |
396 | Typical usage is twofold: | 412 | Typical usage is twofold: |
397 | <ul> | 413 | <ul> |
398 | <li>Tweak <tt>package.loaders</tt></li> | 414 | <li>Tweak <tt>package.loaders</tt></li> |
399 | <li>Load some additional C functions in the global space (of course only a C function will be able to do this).</li> | 415 | <li>Load some additional C functions in the global space (of course only a C function will be able to do this).</li> |
400 | </ul> | 416 | </ul> |
401 | That way, all changes in the state can be properly taken into account when building the function lookup database. Default is <tt>nil</tt>. | 417 | That way, all changes in the state can be properly taken into account when building the function lookup database. Default is <tt>nil</tt>. |
402 | <br/> | 418 | <br /> |
403 | (Since version 3.7.6) If <tt>on_state_create()</tt> is a Lua function, it will be transfered normally before the call. | 419 | (Since version 3.7.6) If <tt>on_state_create()</tt> is a Lua function, it will be transfered normally before the call. |
404 | <br/> | 420 | <br /> |
405 | 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. | 421 | 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. |
406 | </td> | 422 | </td> |
407 | </tr> | 423 | </tr> |