lua-users home
lua-l archive

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


Joshua Haberman wrote:
> > 32 bit pointers on a 64 bit system. 
> > 
> > They just have to reside in the lowest 4 GB (actually it's more
> > efficient to only use the lowest 2 GB). That's easy to guarantee
> > since LJ2 already uses a (much faster) bundled memory allocator.
> > You can turn it off in 32 bit mode, but not in 64 bit mode.
> 
> Interesting, how does this coexist with malloc()?  Are you calling
> brk or mmap to get your memory?

It doesn't use malloc() (or brk(), which might confuse malloc).

It allocates pages with mmap() or VirtualAlloc(), like any add-on
memory allocator would need to. In fact it's a relentlessly
butchered and tuned variant of dlmalloc. I've tested many other
allocators, but this was the best match for Lua's needs. It's
about 10x faster than MSVCRT's malloc(). :-)

[A bump allocator would be even faster of course. But this is not
feasible without a moving GC, which would be a really big redesign.
It would cause a lot of trouble with the Lua/C API, too.]

--Mike