Skip to content

Memory leak when integrating Unity with Flutter on Android using flutter_embed_unity #43

Closed
@quoctruongkt

Description

@quoctruongkt

I'm encountering a memory leak issue on Android when integrating Unity into a Flutter app using the flutter_embed_unity plugin.

Environment:
Flutter version: 3.29.3

Plugin version: flutter_embed_unity 1.2.7

Platform: Android

Description:
When running Flutter or Unity independently, memory usage remains stable.

However, once Unity is embedded into the Flutter app, RAM usage increases continuously, even when the app is idle and no interaction occurs.

The issue only happens during integration, which suggests a possible leak or lifecycle management problem in the plugin or its Android embedding.

Steps to Reproduce:
Create a basic Flutter project.

Integrate Unity using flutter_embed_unity per documentation.

Launch the app on an Android device.

Monitor RAM usage in Android Studio or via adb shell dumpsys meminfo.

Observe memory increasing over time without user interaction.

Expected Behavior:
Memory usage should remain stable when the app is idle, similar to running Flutter or Unity standalone.

Actual Behavior:
Memory usage continues to grow indefinitely when Unity is embedded, leading to eventual performance degradation or crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions