Skip to content

[Flutter] Native memory usage keeps increasing after repeatedly creating and disposing SpineWidget on Android and Windows #3150

Description

@xXYxxdMC-GH

Environment

  • Android: 16
  • Windows: 10 x64
  • Flutter: 3.44.6
  • spine_flutter: 4.2.36

Steps to reproduce

  1. Create a page containing a SpineWidget.
  2. Open the page and initialize the Spine animation.
  3. Leave the page and dispose the widget.
  4. Repeat this process many times.

Expected behavior

After disposing the SpineWidget, native memory usage should return close to the original level.

Actual behavior

Native memory usage keeps increasing after repeatedly creating and disposing SpineWidget.

On Android, after around 300-400 open/close cycles:
Native Heap: Pss: ~881 MB Rss: ~884 MB

Meanwhile:
Dalvik Heap: Alloc: ~2.9 MB

Graphics memory also remains relatively stable:
Graphics: ~64 MB

This suggests that the memory increase is not caused by Dart/Java heap growth, but likely by native resources.

The same behavior can also be observed on Windows: repeatedly creating and destroying SpineWidget instances causes process memory usage to continuously increase.

On Windows, the working set can be reduced by memory trimming, but Android native heap allocation remains high.

This issue does not occur when using normal Flutter widgets without SpineWidget.

Additional notes

Could you please check whether native resources inside the Spine Flutter runtime are properly released when SpineWidget is disposed?

Thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions