[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can't get custom allocation function to work
- From: Ralph Hempel <rhempel@...>
- Date: Tue, 24 Mar 2009 10:34:03 -0400
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
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 by
Ummm, besides the leak, should you not be returning:
return( mem )
since mem is already a pointer to the memory you allocated?
And this expression &(*mem) is very strange. I parse that as:
(the adress of ( (the contents of mem) ???? )
my compiler warns that the subscripted value is neither an array nor a