Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117946320
D1237.1775484331.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D1237.1775484331.diff
View Options
diff --git a/lib/kolab_sync_data_email.php b/lib/kolab_sync_data_email.php
--- a/lib/kolab_sync_data_email.php
+++ b/lib/kolab_sync_data_email.php
@@ -50,6 +50,8 @@
'to' => 'to',
);
+ static $memory_accumulated = 0;
+
/**
* Special folder type/name map
*
@@ -288,6 +290,7 @@
else if ($airSyncBaseType == Syncroton_Command_Sync::BODY_TYPE_MIME) {
// Check if we have enough memory to handle the message
$messageBody = $this->message_mem_check($message, $headers->size);
+ static::$memory_accumulated += $headers->size;
if (empty($messageBody)) {
$messageBody = $this->storage->get_raw_body($message->uid);
@@ -1661,6 +1664,14 @@
}
}
+
+ private function mem_check($need)
+ {
+ $mem_limit = parse_bytes(ini_get('memory_limit'));
+ $memory = static::$memory_accumulated;
+ return $mem_limit > 0 && $memory + $need > $mem_limit ? false : true;
+ }
+
/**
* Checks if the message can be processed, depending on its size and
* memory_limit, otherwise throws an exception or returns fake body.
@@ -1675,7 +1686,7 @@
// as streams). It also happens when parsing the plain/html text body
// in getMessagePartBody() though the footprint there is probably lower.
- if (!rcube_utils::mem_check($size * 5)) {
+ if (!$this->mem_check($size * 5)) {
// If we already rised the memory we throw an exception, so the message
// will be synchronized in the next run (then we might have enough memory)
if ($memory_rised) {
@@ -1693,7 +1704,7 @@
if (ini_set('memory_limit', $memory_needed) !== false) {
// Memory has been rised, check again
- if (rcube_utils::mem_check($size * 5)) {
+ if ($this->mem_check($size * 5)) {
return;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 6, 2:05 PM (4 d, 5 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18739317
Default Alt Text
D1237.1775484331.diff (1 KB)
Attached To
Mode
D1237: Manually track memory usage
Attached
Detach File
Event Timeline