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

Potential memory leak (?) #147

Open
GenaTheCrocodile opened this issue Jul 6, 2024 · 4 comments
Open

Potential memory leak (?) #147

GenaTheCrocodile opened this issue Jul 6, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@GenaTheCrocodile
Copy link

Godot version

4.2.2

Plugin version

3.1.1

Phone information

Huawei P40 lite JNY-LX1 EMUI version 12.0.0

Issue description

It seems like the admob plugin (on Android, can't test it on iOS) leaks memory. I tested it using the sample project that comes with the plugin. When you load and then free a rewarded ad, the object counter in godot doesn't decrease.
Before loading any ads:
image
After loading and freeing rewarded ads:
image

Steps to reproduce

  1. Create a new empty project and install the admob plugin
  2. Select Main.tscn (in addons/admob/sample) as the main scene
  3. Deploy with remote debug on android and open the objects' monitor
  4. Go to the rewarded tab on your phone (inside the sample app)
  5. Remember the current amount of objects
  6. Load and free an arbitrary amount of ads
  7. Check the number of objects

Additional context

No response

@GenaTheCrocodile GenaTheCrocodile added the bug Something isn't working label Jul 6, 2024
@catabriga
Copy link

I have noticed the same thing. After a stress test the application crashes due to memory usage only if the admob plugin is enabled.

@Leotti
Copy link

Leotti commented Jul 16, 2024

I found a memory leak in the AdView.gd script.

These RefCounted objects are never deleted because they connect the plugin's signals to lambda functions. The signals are never disconnected and so the references stay.

I'm not sure if this is the script responsible for the issue, but it could still cause some problems. I was able to fix the leak by using normal functions instead of anonymous lambdas.
I added a cleanup function to disconnect all the signals, but it seems to work even without it. This might just be some of Godot's systems working that I don't understand.

@gumaciel
Copy link
Contributor

Thank you for opening this issue, we will investigate

@gumaciel gumaciel pinned this issue Sep 2, 2024
@gumaciel
Copy link
Contributor

gumaciel commented Sep 3, 2024

I can confirm this bug, but it's from other repository, I'll proceed with the migration

@gumaciel gumaciel transferred this issue from poingstudios/godot-admob-android Sep 3, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Godot AdMob Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

4 participants