[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Can't get custom allocation function to work
- From: "kathrin_69@..." <kathrin_69@...>
- Date: Tue, 24 Mar 2009 15:09:30 +0100
I'm trying to replace the Lua default l_alloc function with my own one.
My aim is to have all memory Lua allocates inside a single array of
I've tried different implementations of a custom function with less and
less features. None of that worked (the library functions crashed due to
memory access error after a time).
Now I tried the very simplest version of a custom function I could come
up with. It just allocs and returns the memory asked for. It doesn't
care about freeing of memory, re-allocation, corruption checks,
fragmentation or anything else.
void* alloc_impl_manual( void* ptr, size_t osize, size_t nsize )
std::vector<unsigned char>* mem = new std::vector<unsigned
//yes, it will leak. don't care for now
return &(*mem); //returned memory position should be aligned
The problems/crashes remains.
I must do some fundamental error or understand some detail wrong. Any
Thank you in advance!