getsentry / sentry-electron

The official Sentry SDK for Electron
https://sentry.io/
MIT License
224 stars 58 forks source link

Memory Composition and Leak Detection #971

Open kasniRC opened 1 month ago

kasniRC commented 1 month ago

Problem Statement

Should be capable of periodically or continuously monitoring the memory usage of the web rendering process, providing insights into the memory allocation of various components and associating them with specific code segments. Specifically, the tool should offer the following functionalities:

  1. Memory Composition Detection:
  1. Memory Leak Detection:
  1. Code Correlation Analysis:
  1. Diagnostics and Optimization Suggestions:

Solution Brainstorm

Lms24 commented 1 month ago

Hey @kasniRC thanks for the suggestion!

I agree this sounds interesting! Memory profiling and related ideas have been floating around but so far aren't really a thing in the various Sentry SDKs (and neither in the product). We have no concrete plans though for these features, so I'm gonna backlog the issue.

cc @timfish feel free to chime in with ideas or quick wins!

timfish commented 1 month ago

With Electron we can debug/profile all the renderer/browser processes from the main app process. This means we can potentially get a lot more info that you can with the regular browser SDK.

My main concern would be the performance implications because whenever I've run these tools myself to track down leaks and performance issues, they have a huge impact.

You can already use Sentry's browser profiling integration in the Electron renderers which uses browser js "self profiling" which is more geared to be used in production: https://docs.sentry.io/platforms/javascript/profiling/