diff options
author | NIkita-Ruzanov <nikita.ruzanov@gmail.com> | 2016-04-07 22:48:11 +0300 |
---|---|---|
committer | HoĆ V. DINH <dinh.viet.hoa@gmail.com> | 2016-04-07 12:48:10 -0700 |
commit | 3ad52b208aa5d637a249bbaaee3aa13fcb5566d2 (patch) | |
tree | 2706553c4767d77177850610340365533afa7481 | |
parent | 1225473d8973aafe24619f0b9ec48f7567da6f18 (diff) |
Fix for high memory usage during loggin of large request (#1396)
-rw-r--r-- | src/core/smtp/MCSMTPSession.cpp | 2 | ||||
-rwxr-xr-x | src/objc/imap/MCOIMAPSession.mm | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | src/objc/smtp/MCOSMTPSession.mm | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/core/smtp/MCSMTPSession.cpp b/src/core/smtp/MCSMTPSession.cpp index 166a58cd..758f5c65 100644 --- a/src/core/smtp/MCSMTPSession.cpp +++ b/src/core/smtp/MCSMTPSession.cpp @@ -230,8 +230,10 @@ static void logger(mailsmtp * smtp, int log_type, const char * buffer, size_t si bool isBuffer = isBufferFromLogType(log_type); if (isBuffer) { + AutoreleasePool * pool = new AutoreleasePool(); Data * data = Data::dataWithBytes(buffer, (unsigned int) size); session->connectionLoggerNoLock()->log(session, type, data); + pool->release(); } else { session->connectionLoggerNoLock()->log(session, type, NULL); diff --git a/src/objc/imap/MCOIMAPSession.mm b/src/objc/imap/MCOIMAPSession.mm index bec998c8..2eba5cc0 100755 --- a/src/objc/imap/MCOIMAPSession.mm +++ b/src/objc/imap/MCOIMAPSession.mm @@ -42,7 +42,9 @@ public: virtual void log(void * sender, ConnectionLogType logType, Data * data) { - [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; + @autoreleasepool { + [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; + } } virtual void queueStartRunning() diff --git a/src/objc/smtp/MCOSMTPSession.mm b/src/objc/smtp/MCOSMTPSession.mm index 9406a719..04e3993b 100644..100755 --- a/src/objc/smtp/MCOSMTPSession.mm +++ b/src/objc/smtp/MCOSMTPSession.mm @@ -38,7 +38,9 @@ public: virtual void log(void * sender, ConnectionLogType logType, Data * data) { - [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; + @autoreleasepool { + [mSession _logWithSender:sender connectionType:(MCOConnectionLogType)logType data:MCO_TO_OBJC(data)]; + } } virtual void queueStartRunning() |