Merge branch 'release-5.2' of github.com:apple/foundationdb into release-5.2

This commit is contained in:
Evan Tschannen 2018-07-08 20:12:36 -07:00
commit d894f4cd52
2 changed files with 18 additions and 5 deletions

View File

@ -268,10 +268,12 @@ struct Peer : NonCopyable {
// Throw away the current unsent list, dropping the reference count on each PacketBuffer that accounts for presence in the unsent list
unsent.discardAll();
// Compact reliable packets into a new unsent range
PacketBuffer* pb = unsent.getWriteBuffer();
pb = reliable.compact(pb, NULL);
unsent.setWriteBuffer(pb);
// If there are reliable packets, compact reliable packets into a new unsent range
if(!reliable.empty()) {
PacketBuffer* pb = unsent.getWriteBuffer();
pb = reliable.compact(pb, NULL);
unsent.setWriteBuffer(pb);
}
}
void onIncomingConnection( Reference<IConnection> conn, Future<Void> reader ) {

View File

@ -88,10 +88,18 @@ volatile int32_t FastAllocator<Size>::pageCount;
thread_local bool memSample_entered = false;
#endif
#ifdef ALLOC_INSTRUMENTATION_STDOUT
thread_local bool inRecordAllocation = false;
#endif
void recordAllocation( void *ptr, size_t size ) {
#ifdef ALLOC_INSTRUMENTATION_STDOUT
if( inRecordAllocation )
return;
inRecordAllocation = true;
std::string trace = platform::get_backtrace();
printf("Alloc\t%p\t%d\t%s\n", ptr, size, platform::get_backtrace().c_str());
printf("Alloc\t%p\t%d\t%s\n", ptr, size, trace.c_str());
inRecordAllocation = false;
#endif
#ifdef ALLOC_INSTRUMENTATION
if( memSample_entered )
@ -143,7 +151,10 @@ void recordAllocation( void *ptr, size_t size ) {
void recordDeallocation( void *ptr ) {
#ifdef ALLOC_INSTRUMENTATION_STDOUT
if( inRecordAllocation )
return;
printf("Dealloc\t%p\n", ptr);
inRecordAllocation = false;
#endif
#ifdef ALLOC_INSTRUMENTATION
if( memSample_entered ) // could this lead to deallocations not being recorded?