If I have: ```class Foo { fun get(): Something } ...
# getting-started
If I have:
Copy code
class Foo { fun get(): Something }

operator fun Bar.getValue(o: Any?, property: KProperty<*>): Something = Foo().get()

val prop by Bar()
Will the Foo instance get GCed?
Looks like a yes to me, as the instance of Foo lives inside the scope of the getValue function.
the thing changes if “Something” keeps a reference of the Foo class
Lazy seems to do something similar, the difference is that the reciever is Lazy<T>, and that has to not have been GCed... Is that some special case?
the Lazy implementation keeps an internal reference to its output. You can check that behavior on the SynchronizedLazyImpl class
I also have a reference to the Something in Foo, I just don't know if Foo gets created on each access or gets stored once and just the get() is called on access... Actually, I'm pretty sure it gets recreated, I'm just not to sure how to avoid that and still keep the reciever not to be Foo