mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
merged with upstream/master
This commit is contained in:
commit
dbd78d2401
77 changed files with 2311 additions and 1333 deletions
|
@ -73,6 +73,7 @@ public:
|
|||
|
||||
template<class ClientClass> bool applyToAllCachedEntries(ClientClass& c,bool (ClientClass::*method)(Value&));
|
||||
|
||||
uint32_t size() const { return mDataMap.size() ; }
|
||||
private:
|
||||
|
||||
bool update_lrumap(const Key &key, time_t old_ts, time_t new_ts);
|
||||
|
|
|
@ -279,11 +279,22 @@ void *SmallObject::operator new(size_t size)
|
|||
#endif
|
||||
|
||||
RsStackMutex m(_mtx) ;
|
||||
void *p = _allocator.allocate(size) ;
|
||||
|
||||
// This should normally not happen. But that prevents a crash when quitting, since we cannot prevent the constructor
|
||||
// of an object to call operator new(), nor to handle the case where it returns NULL.
|
||||
// The memory will therefore not be deleted if that happens. We thus print a warning.
|
||||
|
||||
if(_allocator._active)
|
||||
return _allocator.allocate(size) ;
|
||||
else
|
||||
{
|
||||
std::cerr << "(EE) allocating " << size << " bytes of memory that cannot be deleted. This is a bug, except if it happens when closing Retroshare" << std::endl;
|
||||
return malloc(size) ;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_MEMORY
|
||||
std::cerr << "new RsItem: " << p << ", size=" << size << std::endl;
|
||||
#endif
|
||||
return p ;
|
||||
}
|
||||
|
||||
void SmallObject::operator delete(void *p,size_t size)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue