More alignment crap.
This commit is contained in:
@@ -1354,7 +1354,7 @@ char* LLPrivateMemoryPool::allocate(U32 size)
|
|||||||
//if the asked size larger than MAX_BLOCK_SIZE, fetch from heap directly, the pool does not manage it
|
//if the asked size larger than MAX_BLOCK_SIZE, fetch from heap directly, the pool does not manage it
|
||||||
if(size >= CHUNK_SIZE)
|
if(size >= CHUNK_SIZE)
|
||||||
{
|
{
|
||||||
return (char*)malloc(size) ;
|
return (char*)ll_aligned_malloc_16(size) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
char* p = NULL ;
|
char* p = NULL ;
|
||||||
|
|||||||
@@ -100,7 +100,11 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // r
|
|||||||
void* ret = ll_aligned_malloc_16(size);
|
void* ret = ll_aligned_malloc_16(size);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
{
|
{
|
||||||
memcpy(ret, ptr, old_size);
|
if (ret)
|
||||||
|
{
|
||||||
|
// Only copy the size of the smallest memory block to avoid memory corruption.
|
||||||
|
memcpy(ret, ptr, llmin(old_size, size));
|
||||||
|
}
|
||||||
ll_aligned_free_16(ptr);
|
ll_aligned_free_16(ptr);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user