Skip to content

Potential memory leak while Gradle app build benchmark #6266

@FireHook

Description

@FireHook

Version

4.0.0

Summary

I did the migration from Apollo 2.5.12 version with such dependencies:

apollographql-apollo-api-jvm = { module = "com.apollographql.apollo:apollo-api-jvm", version.ref = "apollo" }
apollographql-apollo-coroutines-support = { module = "com.apollographql.apollo:apollo-coroutines-support", version.ref = "apollo" }
apollographql-apollo-runtime = { module = "com.apollographql.apollo:apollo-runtime", version.ref = "apollo" }
apollographql-apollo-rx3-support = { module = "com.apollographql.apollo:apollo-rx3-support", version = "2.5.14" }

To Apollo 4.0.0 with such dependencies:

apollographql-apollo-runtime = { module = "com.apollographql.apollo:apollo-runtime", version.ref = "apollo" }
apollographql-apollo-normalized-cache = { module = "com.apollographql.apollo:apollo-normalized-cache", version.ref = "apollo" }

I have noticed that Gradle Profiler throws java.lang.RuntimeException: Multiple Gradle daemons were used. exception during Gradle app build benchmarking using gradle-profiler --gradle-user-home ../benchmark --benchmark --measure-config-time --profile buildscan --scenario-file scripts/buildprofiler/clean_build_scenario --output-dir apk_debug_build, where clean_build_scenario is five times iteration of :app:assembleDebug with --no-build-cache and --no-configuration-cache arguments.

Further investigation shown that Memory leaks might be occurred.

Gradle Profiler Meatspace memory usage while app benchmarking with Apollo 2.5.12
Screenshot 2024-11-20 at 16 05 48

Gradle Profiler Meatspace memory usage while app benchmarking with Apollo 4.0.0
Screenshot 2024-11-20 at 16 05 25

As you can see from screenshots while Apollo 4.0.0 were used, the Meatspace memory used by Gradle increases within each iteration, so it looks like these are memory leaks.

I have tried updating Apollo to newer 4.1.0 version but the problem does not eliminate.

Could you, please, take a look what can cause the issue?

Steps to reproduce the behavior

No response

Logs

(Your logs here)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions