mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-08 23:39:31 -04:00
added a new method rs_malloc that checks its arguments and prints a stacktrace on error/weird call. Changed the code everywhere to use this instead of malloc. Removed some mallocs and replaced with RsTemporaryMemory
This commit is contained in:
parent
9c6e7dfc13
commit
d13526facd
39 changed files with 274 additions and 132 deletions
libretroshare/src/util
|
@ -1,6 +1,7 @@
|
|||
#include <iostream>
|
||||
#include "smallobject.h"
|
||||
#include "util/rsthreads.h"
|
||||
#include "util/rsmemory.h"
|
||||
|
||||
using namespace RsMemoryManagement ;
|
||||
|
||||
|
@ -206,7 +207,7 @@ SmallObjectAllocator::~SmallObjectAllocator()
|
|||
void *SmallObjectAllocator::allocate(size_t bytes)
|
||||
{
|
||||
if(bytes > _maxObjectSize)
|
||||
return malloc(bytes) ;
|
||||
return rs_safe_malloc(bytes) ;
|
||||
else if(_lastAlloc != NULL && _lastAlloc->blockSize() == bytes)
|
||||
return _lastAlloc->allocate() ;
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue