Coder Social home page Coder Social logo

Comments (12)

sockeqwe avatar sockeqwe commented on May 28, 2024

Hm, need to check this more in detail but that issue is new or it broke because of missing androidx compatability.

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

Not sure androidx compatibility is an issue because only the package name were changed from android.support to androidx.

But this is just a guess, I am only aware of what android documentation states

Also I have jetifier enabled so mosby byte code is change to access the correct package from android.support to androidx.

I want to continue to use this library and with a few tweaks I am able to use it with Android Navigation component by only using fragments.

Thanks for the reply.

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

More digging i found out the INSTANCE might be a "constant" referenced somewhere that is the Synthetic class itself

See
image

I just hope this is not kotlin's fault.
Neither mosby, but i still dont know how is this happening.

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

At first sight this seems to be the View interface object which is the fragment 🤔

image

But this is not possible because the subscription to View is being canceled when fragment is onStop().

And TakePhotoFragment already was GC

image

I can only see companion objects here

And the TakePhotoFragment$Companion doesnt have any reference to any presenter except to a TAG string field
image

from mosby.

sockeqwe avatar sockeqwe commented on May 28, 2024

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

The companion object is the one declared in the TakePhotoFragment, it only has a TAG property to use in logs.

There is no big issue with this companion object

My concern is only those synthetic classes from bindintent() method from the previous screenshots I posted, that have an object allocation for each view method.

Like I said, not sure if is kotlin or mosby the source of this issue, but the profiler is telling that those synthetic classes have one corresponding instance and are using 40 bytes on shallow size and 40 on retained size.

By themselves they are not referencing any other object in the heap, but are stuck there still don't know why.

They must be being referenced somewhere as the GC cannot collect them.

This is some dark magic.

I will need to dig more on this

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

Checked kotlin issue tracker and found this.

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

Instead of using lambdas with SAM conversion, I will use object expression for the intent() ViewIntentBinder and check what happens

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

My suspicions are true after all.

Converted all Lambda SAM conversions into object expressions making the code a bit ugly and larger
(Changed Android studio Theme BTW)
image

But after GC all previous synthetic classes instances are no longer allocated 😕

image

So this seems to by a kotlin issue rather than mosby.

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

Now, to reduce the code size i will try to use Anonymous functions instead of Object Expressions and see if this also works

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

And their are back with Anonymous functions 😢

image

image

from mosby.

ruieduardosoares avatar ruieduardosoares commented on May 28, 2024

Never mind

image

The issue continue....

from mosby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.