anchor icon indicating copy to clipboard operation
anchor copied to clipboard

Electron memory leak

Open benjiewheeler opened this issue 3 years ago • 6 comments

Expected Behavior

The memory usage remaining in a reasonable amount

Actual Behavior

The memory usage going as high as 4GB (on an 8GB machine) and causing the system to start swapping which slows everything

Steps to Reproduce the Problem

  1. Login to a dApp
  2. Initiate a few signing requests

Possible Culprit

It seems that this issue is related to electron windows, when the signing request window is closed it's not cleared from the memory, as this behavior is observed only after triggering a couple of signing requests.

Signing & pushing transactions from withing the wallet (such as transfering tokens or manually calling contract actions) doesn't seem to cause this issue.

Specifications

  • Version: 1.3.2
  • Platform: Windows

benjiewheeler avatar Feb 04 '22 20:02 benjiewheeler

I've been looking into this, based on your steps to reproduce, and oddly enough this doesn't seem to always be the case.

How quickly does memory grow to something like 4gb if you use those steps to reproduce the problem?

Thanks for the report - we know there's a memory leak somewhere in here and have long been trying to track it down. It only seems to happen on some operating systems and under certain conditions.

aaroncox avatar Feb 05 '22 17:02 aaroncox

One thing I'd also be curious about is the size of the "Anchor Wallet" folder as the memory leak is occurring.

It's either in %APPDATA% somewhere on Windows, in ~/Library/Application Support on macOS, or ~/.config I think for Linux. If one of those folders is bloating in size, I'm wondering if Electron is trying to load all that data.

aaroncox avatar Feb 05 '22 17:02 aaroncox

sorry for the late response, time is flying nowadays

I had tried to reproduce it (with great difficulty) to check for the size of Anchor Wallet folder, I was trying on WAX blockchain I opened and signed about a dozen signing requests yet RAM usage stayed within the normal (fluctuated between 300MB and 500MB) and the size of Anchor Wallet folder barely changed (fluctuated between 11.2MB & 11.3MB).

Then I initiated a login request (on the WAX testnet) after which I noticed the RAM usage started going up rapidly, (from 400MB to over 1GB in less than 30 seconds) I had to kill it as I had other programs running.

Again the Anchor Wallet folder didn't change in size. so perhaps the cause is related to the use of multi-chains.

benjiewheeler avatar Feb 11 '22 21:02 benjiewheeler

No worries about the late response - I'm super guilty of that nowadays (as evident by this reply) 😅

Oh that's an interesting observation, that after doing requests on WAX and switching to requests on the WAX Testnet is when it started going up rapidly... I'll have to give that a try and see if maybe switching networks triggers something.

I've been running Anchor for a couple weeks now trying to find a way to intentionally cause the memory leak and haven't had any reproducible success. Maybe switching networks is key 🤔

aaroncox avatar Feb 21 '22 23:02 aaroncox

Screenshot_1 Screenshot_2

RAM???

Anchor 1.3.4 / Windows 10 (all actual updates)

How to reproduce - I dont know. Standart usage (login, confirm transaction), total accounts 25.

tudadadu avatar Jul 13 '22 13:07 tudadadu