[I] Memory Leak on macOS
Expected behaviour
When application starts, it uses up a reasonable amount of memory (about 150MB). It shouldn't use much more than that while the application is sitting in the background doing nothing.
Actual behaviour
If I leave the application open in the background, its memory use will keep keep growing so long as there's free memory on the system. (I've seen it go as high as 30GB after running for a few days. For comparison, my notes only take up about 3MB of space)
Steps to reproduce
Start application, let it run for several hours or days, see if the memory usage keeps increasing over time like it does for me
Relevant log output in the Log panel
Expand
[16:32:53] [status] Your tasks are being loaded from your server
[16:42:53] [status] Your tasks are being loaded from your server
[16:52:53] [status] Your tasks are being loaded from your server
[17:02:53] [status] Your tasks are being loaded from your server
[17:12:53] [status] Your tasks are being loaded from your server
[17:22:53] [status] Your tasks are being loaded from your server
[17:23:52] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[17:32:53] [status] Your tasks are being loaded from your server
[17:42:53] [status] Your tasks are being loaded from your server
[17:52:53] [status] Your tasks are being loaded from your server
[18:02:53] [status] Your tasks are being loaded from your server
[18:12:53] [status] Your tasks are being loaded from your server
[18:22:53] [status] Your tasks are being loaded from your server
[18:23:53] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[18:32:53] [status] Your tasks are being loaded from your server
[18:42:53] [status] Your tasks are being loaded from your server
[18:52:53] [status] Your tasks are being loaded from your server
[19:02:53] [status] Your tasks are being loaded from your server
[19:12:53] [status] Your tasks are being loaded from your server
[19:22:53] [status] Your tasks are being loaded from your server
[19:23:52] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[19:32:53] [status] Your tasks are being loaded from your server
[19:42:53] [status] Your tasks are being loaded from your server
[19:52:53] [status] Your tasks are being loaded from your server
[20:02:53] [status] Your tasks are being loaded from your server
[20:12:53] [status] Your tasks are being loaded from your server
[20:22:53] [status] Your tasks are being loaded from your server
[20:23:52] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[20:32:53] [status] Your tasks are being loaded from your server
[20:42:53] [status] Your tasks are being loaded from your server
[20:52:53] [status] Your tasks are being loaded from your server
[21:02:53] [status] Your tasks are being loaded from your server
[21:12:53] [status] Your tasks are being loaded from your server
[21:22:53] [status] Your tasks are being loaded from your server
[21:23:52] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[21:32:53] [status] Your tasks are being loaded from your server
[21:42:53] [status] Your tasks are being loaded from your server
[21:52:53] [status] Your tasks are being loaded from your server
[22:02:53] [status] Your tasks are being loaded from your server
[22:12:54] [status] Your tasks are being loaded from your server
[22:22:54] [status] Your tasks are being loaded from your server
[22:23:53] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[22:32:54] [status] Your tasks are being loaded from your server
[22:42:54] [status] Your tasks are being loaded from your server
[22:52:54] [status] Your tasks are being loaded from your server
[23:02:54] [status] Your tasks are being loaded from your server
[23:12:54] [status] Your tasks are being loaded from your server
[23:22:54] [status] Your tasks are being loaded from your server
[23:23:53] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[23:32:54] [status] Your tasks are being loaded from your server
[23:42:54] [status] Your tasks are being loaded from your server
[23:52:54] [status] Your tasks are being loaded from your server
[00:02:54] [status] Your tasks are being loaded from your server
[00:12:54] [status] Your tasks are being loaded from your server
[00:22:54] [status] Your tasks are being loaded from your server
[00:23:53] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[00:32:54] [status] Your tasks are being loaded from your server
[00:42:54] [status] Your tasks are being loaded from your server
[00:52:54] [status] Your tasks are being loaded from your server
[01:02:54] [status] Your tasks are being loaded from your server
[01:12:54] [status] Your tasks are being loaded from your server
[01:22:54] [status] Your tasks are being loaded from your server
[01:23:53] [warning] onResult - 'network reply error': QNetworkReply::UnknownNetworkError
[01:32:54] [status] Your tasks are being loaded from your server
[01:42:54] [status] Your tasks are being loaded from your server
[01:52:54] [status] Your tasks are being loaded from your server
[02:02:54] [status] Your tasks are being loaded from your server
[02:08:50] [status] Stored 1 note(s) to disk
[02:08:51] [status] Notes directory was modified externally
Information about the application, settings and environment
Expand
QOwnNotes Debug Information
General Info
Current Date: Tue Aug 13 02:09:37 2019
Version: 19.8.4
Build date: Aug 10 2019
Build number: 4444
Platform: macosx
Operating System: macOS Sierra (10.12)
Build architecture: x86_64
Current architecture: x86_64
Release: Travis CI
Qt Version (build): 5.12.2
Qt Version (runtime): 5.12.2
Portable mode: no
Settings path / key: /Users/X/Library/Preferences/com.pbe.QOwnNotes.plist
Application database path: /Users/X/Library/Application Support/PBE/QOwnNotes/QOwnNotes.sqlite
Application arguments: /Applications/QOwnNotes.app/Contents/MacOS/QOwnNotes
Qt Debug: 0
Locale (system): en_US
Locale (interface): en
Icon theme: breeze-qownnotes
Notes in current note folder: 529
Enabled scripts: 6
Server Info
serverUrl: https://abc.xyz
appIsValid: yes
notesPathExists: yes
serverVersion: 15.0.7.0
appVersion: empty
Note folders
currentNoteFolderId: 1
Note folder Notes on abc
id: 1
isCurrent: yes
activeTagId: -1
localPath: /Users/X/Nextcloud/Notes
remotePath: Notes
isShowSubfolders: yes
isUseGit: yes
activeNoteSubFolder name: n
database file: /Users/X/Nextcloud/Notes/notes.sqlite
Enabled scripts
Script External note open
id: 14
path: /Users/X/Library/Application Support/PBE/QOwnNotes/scripts/external-note-open/external-note-open.qml
variablesJson:
{
"executablePath": "kate"
}
identifier: external-note-open
version: 1.0.0
minAppVersion: 18.05.4
Script PGP Encryption
id: 15
path: /Users/X/Library/Application Support/PBE/QOwnNotes/scripts/encryption-pgp/encryption-pgp.qml
variablesJson:
{
"gpgPath": "/usr/local/MacGPG2/bin/gpg",
"publicKey": ""
}
identifier: encryption-pgp
version: 0.0.2
minAppVersion: 17.05.7
Script External note diff
id: 7
path: /Users/X/Library/Application Support/PBE/QOwnNotes/scripts/external-note-diff/external-note-diff.qml
variablesJson:
{
"executablePath": ""
}
identifier: external-note-diff
version: 0.0.1
minAppVersion: 17.07.8
Script Favorite note
id: 8
path: /Users/X/Library/Application Support/PBE/QOwnNotes/scripts/favorite-note/favorite-note.qml
variablesJson: empty
identifier: favorite-note
version: 0.0.1
minAppVersion: 17.05.6
Script Disable read-only mode on note double-click
id: 12
path: /Users/X/Library/Application Support/PBE/QOwnNotes/scripts/disable-readonly-mode/disable-readonly-mode.qml
variablesJson: empty
identifier: disable-readonly-mode
version: 1.0.0
minAppVersion: 18.08.1
Settings
Debug/fakeOldVersionNumber (bool): false
Debug/fileLogging (bool): false
Editor/CurrentSchemaKey (QString): EditorColorSchema-6033d61b-cb96-46d5-a3a8-20d5172017eb
Editor/autoBracketClosing (bool): true
Editor/autoBracketRemoval (bool): true
Editor/disableCursorBlinking (bool): false
Editor/editorWidthInDFMOnly (bool): true
Editor/highlightCurrentLine (bool): true
Editor/vimMode (bool): false
EvernoteImport/AttachmentImportCheckBoxChecked (bool): true
EvernoteImport/ImageImportCheckBoxChecked (bool): true
EvernoteImport/MetaDataUnCheckedList (QStringList): ,
LogWidget/criticalLog (bool): true
LogWidget/debugLog (bool): true
LogWidget/fatalLog (bool): true
LogWidget/infoLog (bool): true
LogWidget/scriptingLog (bool): true
LogWidget/statusLog (bool): true
LogWidget/warningLog (bool): true
MainWindow/mainToolBar.iconSize (qlonglong): 32
MainWindow/noteTextView.ignoreCodeFontSize (bool): true
MainWindow/noteTextView.rtl (bool): false
MainWindow/noteTextView.underline (bool): true
MainWindow/showNotesFromAllNoteSubFolders (bool): false
MessageBoxOverride/log-file-cleared (qlonglong): 1024
MultipleSessionEnabled (bool): true
PersistentScripting/MdNT/pyCommand (QString): empty
ShowSystemTray (bool): true
StartHidden (bool): false
TodoDialog/showCompletedItems (qlonglong): 0
acceptAllExternalModifications (bool): false
allowDifferentNoteFileName (bool): false
allowNoteEditing (bool): true
allowOnlyOneAppInstance (bool): false
appMetrics/disableAppHeartbeat (bool): true
appMetrics/disableTracking (bool): true
appMetrics/notificationShown (bool): true
automaticNoteFolderDatabaseClosing (bool): false
closeTodoListAfterSave (bool): false
currentNoteFolderId (qlonglong): 1
currentWorkspace (QString): 02beec55-0780-48bc-804a-e785923479af
cursorWidth (qlonglong): 1
customNoteFileExtensionList (QStringList): empty
darkMode (bool): false
darkModeColors (bool): false
darkModeIconTheme (bool): false
darkModeTrayIcon (bool): false
defaultNoteFileExtension (QString): txt
disableAutomaticUpdateDialog (bool): true
disableSavedSearchesAutoCompletion (bool): false
dockWasInitializedOnce (bool): true
enableSocketServer (bool): true
externalEditorPath (QString): empty
fullyHighlightedBlockquotes (bool): false
gitCommitInterval (qlonglong): 60
gitExecutablePath (QString): empty
gitLogCommand (QString): /usr/local/bin/gitk
guiFirstRunInit (bool): true
ignoreAllExternalModifications (bool): false
ignoreAllExternalNoteFolderChanges (bool): false
ignoreNoteSubFolders (QString): ^\.
imageScaleDown (bool): false
imageScaleDownMaximumHeight (qlonglong): 1024
imageScaleDownMaximumWidth (qlonglong): 1024
initialLayoutIdentifier (QString): full
insertTimeFormat (QString): yyyy.MM.dd @hh:mm:ss
interfaceFontSize (qlonglong): 11
interfaceLanguage (QString): en
interfaceStyle (QString): Fusion
internalIconTheme (bool): true
itemHeight (qlonglong): 18
localTrash/autoCleanupDays (qlonglong): 3650
localTrash/autoCleanupEnabled (bool): true
localTrash/supportEnabled (bool): true
localTrashSplitterSizes (QByteArray): <binary data>
markdownHighlightingEnabled (bool): true
navigationPanelHideSearch (bool): false
networking/ignoreSSLErrors (bool): false
networking/proxyType (qlonglong): 0
newNoteAskHeadline (bool): true
noteEditIsCentralWidget (bool): false
noteListPreview (bool): false
noteSaveIntervalTime (qlonglong): 10
noteSubfoldersPanelDisplayAsFullTree (bool): true
noteSubfoldersPanelHideSearch (bool): true
noteSubfoldersPanelOrder (qlonglong): 0
noteSubfoldersPanelShowFullPath (bool): false
noteSubfoldersPanelShowNotesRecursively (bool): false
noteSubfoldersPanelShowRootFolderName (bool): true
noteSubfoldersPanelSort (qlonglong): 0
notesPanelOrder (qlonglong): 0
notesPanelSort (qlonglong): 1
notesPath (QString): /Users/X/Nextcloud/Notes
notifyAllExternalModifications (bool): true
overrideInterfaceFontSize (bool): false
ownCloud/supportEnabled (bool): true
ownCloud/todoCalendarBackend (qlonglong): 3
ownCloud/todoCalendarCalDAVServerUrl (QString): empty
ownCloud/todoCalendarCalDAVUsername (QString): empty
ownCloud/userName (QString): X
ownCloudInfo/appIsValid (bool): true
ownCloudInfo/connectionErrorMessage (QString): Unknown error
ownCloudInfo/notesPathExistsText (QString): yes
ownCloudInfo/serverVersion (QString): 15.0.7.0
previousWorkspace (QString): initial
restoreCursorPosition (bool): true
showMenuBar (bool): true
showStatusBar (bool): true
systemIconTheme (bool): false
tagWasAddedToNote (bool): true
taggingShowNotesRecursively (bool): true
tagsPanelHideSearch (bool): false
tagsPanelOrder (qlonglong): 0
tagsPanelSort (qlonglong): 0
toolbar/1/items (QStringList): action_Back_in_note_history, action_Forward_in_note_history, , action_New_note, customAction_journalEntry, action_Remove_note, actionShow_local_trash, actionAllow_note_editing, , actionShow_versions, actionShow_trash, actionShare_note, , actionOpen_List, actionView_note_in_new_window, actionShow_note_in_file_manager
toolbar/1/name (QString): mainToolBar
toolbar/1/title (QString): main toolbar
toolbar/2/items (QStringList): actionFormat_text_bold, actionFormat_text_italic, actionStrike_out_text, actionInsert_code_block, actionInsert_block_quote, action_Increase_note_text_size, action_Decrease_note_text_size, action_Reset_note_text_size
toolbar/2/name (QString): formattingToolbar
toolbar/2/title (QString): formatting toolbar
toolbar/3/items (QStringList): actionInsert_Link_to_note, actionInsert_image, actionInsert_current_time
toolbar/3/name (QString): insertingToolbar
toolbar/3/title (QString): inserting toolbar
toolbar/4/items (QStringList): action_Encrypt_note, actionEdit_encrypted_note, actionDecrypt_note
toolbar/4/name (QString): encryptionToolbar
toolbar/4/title (QString): encryption toolbar
toolbar/5/items (QStringList): actionWorkspaceComboBox, actionStore_as_new_workspace, actionRemove_current_workspace, actionRename_current_workspace, actionSwitch_to_previous_workspace, actionUnlock_panels, , actionToggle_distraction_free_mode, action_Increase_note_text_size, action_Decrease_note_text_size, action_Reset_note_text_size
toolbar/5/name (QString): windowToolbar
toolbar/5/title (QString): window toolbar
toolbar/6/items (QStringList): action_Quit
toolbar/6/name (QString): quitToolbar
toolbar/6/title (QString): quit toolbar
toolbar/size (qlonglong): 6
trashSplitterSizes (QByteArray): <binary data>
useUNIXNewline (bool): false
userMenuExtraStyle (qlonglong): 2
webSocketServerService/bookmarksNoteName (QString): Bookmarks
webSocketServerService/bookmarksTag (QString): bookmarks
webSocketServerService/port (qlonglong): 22222
workspace-02beec55-0780-48bc-804a-e785923479af/noteSubFolderDockWidgetVisible (bool): true
workspace-02beec55-0780-48bc-804a-e785923479af/windowState (QByteArray): <binary data>
workspace-initial/name (QString): Full
workspace-initial/noteSubFolderDockWidgetVisible (bool): true
workspace-initial/windowState (QByteArray): <binary data>
workspaces (QStringList): initial, 02beec55-0780-48bc-804a-e785923479af
Scripts indeed look ok.
The only thing that comes to mind: What happens if you disable all calendars in the Todo settings (so that the calendar items will not be loaded) and empty the calendar item cache.
My QON (1000+ notes) is still down at 87.9MB after a day or two on macOS 10.14.5.
I've disabled all the calendars and cleared the cache. I'll let it run for a few hours and report back
In the next release the amount of calendar items will be viewed in debug output :wink:
Disabling the calendars seems to have done the trick. It is staying steady at ~150MB.
Now to figure out why the todo lists are causing this memory leak...
Thank you. Easier than not knowing anything at all. :) Did you have a lot of todo items?
Yes, about 700 todos spread across 35+ different lists... mine's probably not a typical scenario.
But I use the app mostly for managing notes, so it's not a priority. I'm ok with leaving the todos disabled in the app for now. Just let me know if there's anything I can do to help debug the leak
This took quite a while...
19.8.5
- fixed many memory leaks when receiving network data
- the amount of calendar items will now be showed in the output of the Debug settings
There now is a new release, could you please test it and report if it works for you if you turn on your calendars again?
Looks good so far. It's using a bit more memory than before (~250MB) but it seems to be staying steady and not growing past that. I'm also no longer seeing repeated instances of "Your tasks are being loaded from your server" in the debug logs. But I'll leave it running overnight, just to be sure.
Also, don't know if this is directly related, but the application crashed (segfault) while trying to open the todo list window. This has happened twice so far, but I can't reliably reproduce the crash, so it might just be some errant qt stability issue
Edit: Just after I posted this, I got it to crash a third time. Here's what I did:
- Opened the todo list window and waited for it to load some tasks on a few lists
- Closed it without making any changes
- Opened it a few minutes later...
- Crashed.
should I open a new issue for this?
Looks good so far
thank you for the feedback
I'm also no longer seeing repeated instances of "Your tasks are being loaded from your server" in the debug logs.
You should see one every 10min! Did you turn off some of the logging levels?
I got it to crash a third time. Here's what I did
So far I wasn't able to reproduce this. Did you also have this before the current release?
You should see one every 10min! Did you turn off some of the logging levels?
Maybe I missed it and it got buried amidst all the debug messages. I'll turn on logging to a file so I don't lose the history when it crashes.
So far I wasn't able to reproduce this. Did you also have this before the current release?
No, it never crashed before this release. But I don't think I ever tried opening the todo list multiple times in a session as per the above steps I mentioned.
However, it has crashed two more times since my last comment but these times it crashed on its own while just running in the background (I did step 1 and 2 above, but hadn't yet gone back to reopen the todo list).
When I wake up tomorrow, I'll fiddle around with this some more to try and pin down exactly what circumstances leads to it crashing.
Then we should make a new issue, could you please post one (with a new debug output where the amount of Calendar items is printed). And Can you please turn on logging to a log file in the Debug options settings.
I could reproduce it under macOS (only there so far) with the latest release, but not in my Dev-Version. I now install the newest Qt development environment on my macBook, maybe I can then reproduce it.