I just developing library and dont have huge examples to show, just care how usage of this library will looks like from the user point of view.
In the upper example you saw only two reference, but, as I mention, its possible what there are MANY usage of references to the same objects.
Imagine not only one table but ten tables, lists and trees each of them display same data in different forms. Plus many inplace editors and form dialogs.
Multiply these two fields by number of GUI representations and youll get unreasonable big part of application contains absolutely useless code.
The whole topic is not about add memory to user workstation or increase its partiotion to allow run application of any size.
Its about a bug in Kotlin code generation.
The referenses to any class, all its fields - are constants so thay must be represented by
I saw the topic in Kotlin bug-tracker and see the problem is known. Hope it will be fixed soon.
PS: Yep, reflections are slower but most of overhead affects only GUI setup stage, which is not a big deal. Use of Kotlin references a little faster but add huge overhead in size affecting whole application forever.
Plus, I personally hate to use expressions known to be ineffective in the speed or size and, as lib developer, I trying to guard users from such implementations.