AppLovin / AppLovin-MAX-Unity-Plugin

121 stars 33 forks source link

The MaxSdkCallback.ForwardEvent is bulky and produces allocations. #294

Closed romanmbraingames closed 5 months ago

romanmbraingames commented 10 months ago

MAX Plugin Version

5.11.3

Unity Version

2021.3.28f

Device/Platform Info

Checked in Unity Editor and Android Device (Motorola ellis)

Current Behavior

Currently, the MaxSdkCallbacks.ForwardEvent allocates around 200KB every OnBannerAdLoadedEvent, OnBannerAdClickedEvent (i.e. every that contains AdInfo).

It looks like the current implementation of the method is not efficient enough for a usage.

image

image

On our side we did a several in-place changes above the current implementation to address this problem on our side but it will be nice to cover this on the side of the SDK.

image

List of changes:

Expected Behavior

No response

How to Reproduce

It's easy to reproduce, just integrate Ads banner and launch an application. Every time when you are receiving an event with adInfo inside you will notice the spike of the CPU and memory allocations.

Additional Info

No response

santoshbagadi commented 10 months ago

Hi @romanmbraingames , thank you for raising the issue. We're already working on a way to reduce the amount of serialize/deserialize calls. Will update here once the fix is released.

maximilianbuck commented 5 months ago

Hi @romanmbraingames , we made changes to move serialize/deserialize to a background thread and released them in version 6.4.1 of our Unity Plugin.