lua-users home
lua-l archive

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


Robert G. Jakabosky wrote:
> Will LJ2 try to reserve that lower 2-4Gbytes of the processes address space 
> when the lua_State is created?  If it doesn't then it will be competting with 
> the other 64bit C code for use of the lower 2-4Gbytes of address space.

That's rather unlikely. I've looked at the allocation patterns of
the major x64 operating systems and one always gets higher
addresses. Some also explicitly avoid the lowest 4G.

> Also if a program needs to create many lua_States, then that lower 2-4Gbyte 
> address range will get crowded fast.

If you allocate so many states with so many GC objects that you
outgrow 4G, you are asking for trouble anyway. This certainly
isn't a common use case.

> > If someone, somehow eventually outgrows the 4G limit one could
> > switch to compressed pointers. Shifting the pointer by 3 or 4 bits
> > results in a 32 GB or 64 GB limit.
> 
> It might be good to do this even if each instance of LJ2 isn't going to use 
> more then 4Gbytes of memory.

Given that the current Lua GC isn't up to the task, it doesn't
make sense to implement this now. IMHO this is a typical case of
YAGNI.

> LJ2 could then reserve a full 1-4Gbyte block of the processes
> address space as read/write protected (using mmap).

Most OS are very unhappy if you do this. This is a solution in
search of a problem.

--Mike