Clean processed imessages

pull/194/head
M66B 4 years ago
parent d07be6b347
commit cd061077b3

@ -1160,6 +1160,7 @@ public class IMAPMessage extends MimeMessage implements ReadableMime {
headers = null;
envelope = null;
bs = null;
items = null;
receivedDate = null;
size = -1;
type = null;

@ -33,7 +33,6 @@ import com.sun.mail.iap.Argument;
import com.sun.mail.iap.ProtocolException;
import com.sun.mail.iap.Response;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPMessage;
import com.sun.mail.imap.IMAPStore;
import com.sun.mail.imap.protocol.IMAPProtocol;
import com.sun.mail.imap.protocol.IMAPResponse;
@ -155,7 +154,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
return;
}
Log.i("Boundary run end=" + state.end + "/" + end);
Log.i("Boundary run end=" + state.end + "/" + end + " memory=" + Log.getFreeMemMb());
int found = 0;
try {
@ -308,7 +307,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
}
}
Log.i("Boundary device done");
Log.i("Boundary device done memory=" + Log.getFreeMemMb());
return found;
}
@ -460,6 +459,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
Log.i("Boundary server index=" + state.index);
int from = Math.max(0, state.index - (pageSize - found) + 1);
Message[] isub = Arrays.copyOfRange(state.imessages, from, state.index + 1);
Arrays.fill(state.imessages, from, state.index + 1, null);
state.index -= (pageSize - found);
FetchProfile fp0 = new FetchProfile();
@ -526,7 +526,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
Log.e(browsable.name + " boundary server", ex);
db.folder().setFolderError(browsable.id, Log.formatThrowable(ex));
} finally {
((IMAPMessage) isub[j]).invalidateHeaders();
isub[j] = null;
//((IMAPMessage) isub[j]).invalidateHeaders();
}
}
@ -535,7 +536,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
close(state, false);
}
Log.i("Boundary server done");
Log.i("Boundary server done memory=" + Log.getFreeMemMb());
return found;
}

@ -2809,6 +2809,7 @@ class Core {
int from = Math.max(0, i - DOWNLOAD_BATCH_SIZE + 1);
Message[] isub = Arrays.copyOfRange(imessages, from, i + 1);
Arrays.fill(imessages, from, i + 1, null);
// Fetch on demand
int free = Log.getFreeMemMb();
@ -2846,7 +2847,8 @@ class Core {
Log.e(folder.name, ex);
} finally {
// Free memory
((IMAPMessage) isub[j]).invalidateHeaders();
isub[j] = null;
//((IMAPMessage) isub[j]).invalidateHeaders();
}
}
}

Loading…
Cancel
Save