NC 1.4.0 - Memory Leak when opening directories in Google Drive [FIXED]

Questions, glitches, bugs and crashes
Locked
GuiB
Posts: 6
Joined: Thu Sep 01, 2022 3:04 pm

NC 1.4.0 - Memory Leak when opening directories in Google Drive [FIXED]

Post by GuiB » Thu Sep 01, 2022 3:15 pm

I'm seeing a big memory leak from Nimble Commander 1.4.0 when I'm working inside my Google Drive directory. I think it is happening when the internal files are not downloaded in my computer completely.

When I try to open one, Nimble Commander doesn't freeze, but I can't change directories and the used memory by NC increase drastically rapidly. I'm attaching a sampling analysis while the memory leak occur.

Thanks and all the best!
Attachments
Nimble Commander-Sample-GoogleDrive-MemoryLeak-20220901.zip
(31.56 KiB) Downloaded 152 times

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive

Post by mike » Sat Sep 03, 2022 8:09 pm

Hi, thanks for reporting the issue, that's concerning for sure.
I've found a place that might be a culprit of such behaviour.
Does Google Drive work as a custom file system on macOS? (I'm not using it personally)

GuiB
Posts: 6
Joined: Thu Sep 01, 2022 3:04 pm

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive

Post by GuiB » Mon Sep 05, 2022 7:10 pm

Dear Mike, sorry for the delay I didn't get a notification...

Yes Google Drive seems to work as a custom file system since it mount in Finder as an attached drive and the files get downloaded when I open them or I need to "make them accessible offline" by invoking this function from the context menu by selecting a file or folder. I'm attaching a screenshot to show you how the drive is mounted and how it looks when the file are not downloaded.

Please let me know if I can help you further! In the meantime, I guess I could make it work reliably by selecting the base directory and make it accessible offline.

Thanks and all the best!
Attachments
Capture d’écran, le 2022-09-05 à 15.02.57.png
Capture d’écran, le 2022-09-05 à 15.02.57.png (490.1 KiB) Viewed 13008 times

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive

Post by mike » Sat Oct 08, 2022 1:56 pm

Found the root cause, the next preview and/or release (v1.4.0) will behave as expected.
This seem to be an Apple's problem with their relatively new API - File Providers for cloud storage.
In short, these directories are initially SF_DATALESS and fetching ATTR_DIR_ENTRYCOUNT via getattrlist() reports that such a directory has 1'431'194'446 entries instead of erroring out somehow or triggering a background download as a directory iteration normally does.
So what appeared as a memory leak was Nimble Commander laboriously preallocating memory to read 1'431'194'446 entries from the directory.

GuiB
Posts: 6
Joined: Thu Sep 01, 2022 3:04 pm

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive [FIXED]

Post by GuiB » Fri Oct 21, 2022 12:01 am

Dear Mike, thanks for the update! Build 3838 seems to have fixed the issue, thanks!

GuiB
Posts: 6
Joined: Thu Sep 01, 2022 3:04 pm

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive [FIXED]

Post by GuiB » Thu Oct 27, 2022 2:23 am

Hi Mike, I spoke a little too fast... Build 3838 fixed most of the problem (I can now navigate most of my Google Drive). However, I still get a big memory leak when I try to access a directory that wasn't previously accessed with Finder. Nimble Commander seems to scan the directory and allocate a big section of memory.

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive [FIXED]

Post by mike » Tue Nov 01, 2022 9:25 pm

Interesting, I think these scenarios worked for me. Will look into it again, likely to ditch this buggy API altogether.

User avatar
mike
Posts: 1060
Joined: Thu Jul 16, 2015 5:35 am
Location: Exeter, UK

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive [FIXED]

Post by mike » Sun Dec 18, 2022 2:14 pm

Hi, could you please try this preview build to check if the issue is gone on your setup?
https://magnumbytes.com/downloads/previ ... (3861).dmg
I removed the usage of that buggy API entirely.

GuiB
Posts: 6
Joined: Thu Sep 01, 2022 3:04 pm

Re: NC 1.4.0 - Memory Leak when opening directories in Google Drive [FIXED]

Post by GuiB » Fri Dec 23, 2022 8:36 pm

Hi Mike, sorry I didn't see your reply before now... I just downloaded your new version, I'll let you know if I get into this bug again or not! Thanks!

------
UPDATE:

I just went inside my Google Drive directories and looked around almost all my directories and I didn't have a glitch! So, I think now it is fixed! I think it feels snappier as well! There were some directories that took a second to open instead of feeling instant even if there were only a few files inside, but that's about it, everything loaded correctly and the memory used by Nimble Commander stayed quite low (now at 167.4 Mo).

I'll let you know if this happens again by using Nimble Commander normally

Thanks again!

Locked