Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with Flutter Session Replay #142

Open
ioannisj opened this issue Dec 24, 2024 · 4 comments
Open

Memory leak with Flutter Session Replay #142

ioannisj opened this issue Dec 24, 2024 · 4 comments
Labels
bug Something isn't working Session Replay

Comments

@ioannisj
Copy link

Description

from: https://posthog.com/questions/memory-leak-with-flutter-session-replay

@ioannisj ioannisj added the bug Something isn't working label Dec 24, 2024
@marandaneto
Copy link
Member

Asked questions on the link.

@JobiJoba
Copy link

JobiJoba commented Jan 7, 2025

I have the same error message but when I have a TextFormField on the page and SessionReplay activated.

Once the focus in on the TextFormField I get that error message every seconds

flutter: Error: Failed to capture screenshot.
flutter: Snapshot is the same as the last one.

My page also has SVG but removing them didn't change anything to the message - I don't know if it leads to a memory leak.

class OnboardingPage extends StatelessWidget {
  const OnboardingPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Form(
          child: Column(
            children: [
              TextFormField(
                 decoration: const InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: 'Enter your character name',
                ),
                validator: (value) {
                  if (value == null || value.isEmpty) {
                    return 'Please enter a name';
                  }
                  return null;
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

my config

final config =
        PostHogConfig('xxx')
          ..debug = kDebugMode
          ..captureApplicationLifecycleEvents = true
          ..host = 'https://us.i.posthog.com'
          ..sessionReplay = true
          ..sessionReplayConfig.maskAllTexts = false
          ..sessionReplayConfig.maskAllImages = false;

A simple example of how I use it in my project using 4.9.1.

@marandaneto
Copy link
Member

flutter: Snapshot is the same as the last one.

this is not an error btw, it's just logging.

@marandaneto
Copy link
Member

I have the same error message but when I have a TextFormField on the page and SessionReplay activated.

Once the focus in on the TextFormField I get that error message every seconds

flutter: Error: Failed to capture screenshot. flutter: Snapshot is the same as the last one.

My page also has SVG but removing them didn't change anything to the message - I don't know if it leads to a memory leak.

class OnboardingPage extends StatelessWidget {
  const OnboardingPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Form(
          child: Column(
            children: [
              TextFormField(
                 decoration: const InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: 'Enter your character name',
                ),
                validator: (value) {
                  if (value == null || value.isEmpty) {
                    return 'Please enter a name';
                  }
                  return null;
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

my config

final config =
        PostHogConfig('xxx')
          ..debug = kDebugMode
          ..captureApplicationLifecycleEvents = true
          ..host = 'https://us.i.posthog.com'
          ..sessionReplay = true
          ..sessionReplayConfig.maskAllTexts = false
          ..sessionReplayConfig.maskAllImages = false;

A simple example of how I use it in my project using 4.9.1.

@JobiJoba this looks like a different issue, mind creating a new issue and providing an MRE? a sample where I can just run and reproduce the issue since I can't reproduce it myself? Thanks.
I'll need to know which OS, version, Flutter version, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Session Replay
Projects
None yet
Development

No branches or pull requests

3 participants