lua-users home
lua-l archive

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


Hallo,

On Tue, Aug 14, 2012 at 10:52 AM, Martijn van Buul
<martijn.van.buul@ellips.nl> wrote:
>
> The overhead in terms of "amount of boilerplate code" is limited, the actual
> *runtime* overhead is acceptable, but what causes some concern is memory
> usage. The userdata only contains a refcounted pointer, irregardless of the
> size of the data pointed at by that pointer. Simply put, the garbage
> collection fails to realise that there is a difference between a "Point" and
> an "Image", and only "sees" the memory burden of the pointer. It simply
> doesn't realise that the memory footprint of a userdata may be bigger than
> the size of the userdata itself, and when left to its own devices will
> quickly cause memory to run out - even though the memory 'consumed' by the
> lua state will remain low.
>

     Have you tried using placement new for solving this?

-- 
-alex
http://www.artisancoder.com/