lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




Am 15.01.2020 um 23:35 schrieb Andre Leiradella:

On 15/01/20 22:17, Stefan wrote:


Well, that's exactly the problem with area allocators: What if your
data no longer fits into your area?
You can create huge linear allocators. Bonus: if a bogus script exhausts the allocator, the script will end.
Abusing virtual memory is extremely hacky.

Not at all.

Cheers,

Andre

Well, it certainly is an interesting idea. But it has many drawbacks:
 * It only works for one state at a time (if I get your approach right)
 * There will be a lot of dead memory (Lua uses realloc shrinking often)
 * It assumes you have enough virtual memory (only x64)
 * vm.overcommit_memory or equivalent must be enabled
 * Users will complain about what top/Taks manager shows them
* Memory use has an hard upper limit now; or you need to check it for every allocation

Also, the current glibc allocator is *damn* fast. I tried to outsmart it
for a very narrow use case[1] and glibc malloc was still not that much slower - while being a general allocator and threadsafe.

But thanks for the input anyways :)

Greetings

[1] https://github.com/evelance/slaballoc64