Skip to content

RAM usage increases over time #3149

Open

Description

@joshaber

From @cheshire137:

Left the app open for several days, switching between repos occasionally

activity_monitor__all_processes_

😱

I wouldn't be terribly surprised if we're keeping some caches or git stores around.

Activity

  1. added
    bug
    on Oct 24, 2017
  2. changed the title [-]RAM increases over time[/-] [+]RAM iusage ncreases over time[/+] on Oct 24, 2017
  3. changed the title [-]RAM iusage ncreases over time[/-] [+]RAM usage increases over time[/+] on Oct 24, 2017
  4. shiftkey commented on Nov 24, 2017

    @shiftkey
    Member

    I saw this tweet recently and got me to wondering if our habit of logging things to the dev tools might be part of this problem:

    related: if you console.log something with the devtools open it does not get garbage collected. This might seem like an obvious statement, but many forget and spend hours trying to figure out why the app is leaking memory

    — Jay Phelps (@_jayphelps) November 20, 2017
  5. shiftkey commented on Feb 12, 2018

    @shiftkey
    Member

    This link walks through a number of APIs in Electron for profiling memory usage -
    definitely useful for tackling problems like this: http://seenaburns.com/debugging-electron-memory-usage/

  6. cheshire137 commented on Apr 5, 2018

    @cheshire137
    Contributor

    👋 A note that this still occurs in version 1.1.1 in macOS:

    image 9

    This was after a few days of the app being open, switching between branches and repositories.

  7. shiftkey commented on Apr 8, 2018

    @shiftkey
    Member

    @cheshire137 the fact that it's a Helper process suggests that it's the renderer process, which is good because the dev tools can help!

    The next time you see significant memory usage in the app, could you grab a Heap Snapshot by opening the dev tools and clicking these items?

    The file will probably be > 50MB, but if I can get my hands on that it'd be a great start to troubleshooting what's leaking in the app.

  8. cheshire137 commented on Apr 11, 2018

    @cheshire137
    Contributor

    I've got a juicy 1.13GB memory-using GitHub Desktop for you, I just hope I can get the snapshot:

    image

  9. shiftkey commented on Apr 11, 2018

    @shiftkey
    Member
  10. sohel69 commented on Apr 12, 2018

    @sohel69
  11. self-assigned this
    on Sep 17, 2018
  12. shiftkey commented on Sep 21, 2018

    @shiftkey
    Member

    I was chatting with @cheshire137 about this and I realise that I didn't really add more details about what's happening here.

    It comes down to three things:

    • GitStore has a commit cache that we fill with commits over time

    public readonly commitLookup = new Map<string, Commit>()

    private storeCommits(
    commits: ReadonlyArray<Commit>,
    emitUpdate: boolean = false
    ) {
    for (const commit of commits) {
    this.commitLookup.set(commit.sha, commit)
    }
    if (emitUpdate) {
    this.emitNewCommitsLoaded(commits)
    }
    }

    • we keep GitStore instances in memory for the lifetime of the app

    private getGitStore(repository: Repository): GitStore {
    let gitStore = this.gitStores.get(repository.hash)
    if (!gitStore) {
    gitStore = new GitStore(repository, shell)
    gitStore.onDidUpdate(() => this.onGitStoreUpdated(repository, gitStore!))
    gitStore.onDidLoadNewCommits(commits =>
    this.loadAndCacheUsers(repository, this.accounts, commits)
    )
    gitStore.onDidError(error => this.emitError(error))
    this.gitStores.set(repository.hash, gitStore)
    }
    return gitStore
    }

    • the user keeps the app open for a sufficiently long time while interacting with it (switching branches is likely to help speed this process up)

    I'd love to figure out a way to expire the commit cache in a way that doesn't affect the current application state, but this has fallen down my priority queue currently.

  13. added
    performance
    on Sep 21, 2018
  14. added
    priority-2
    and removed
    bug
    on Oct 11, 2018
  15. removed their assignment
    on Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancepriority-2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions