jeudi 10 mars 2022

Memory Management for Type Instance

We are working on reflection project where we need to call different methods from different types and that too from different assemblies.

So What we are doing right now is to Load the all types from Assemblies and cache them in memory on application load to read it while reflection.

Currently we are using Dictionary<string, Type> TypesCache; which holds type name and type instance Assemblies declared types.

So I have question. Rather than keeping all types on start of application into dictionary If we maintain dictionary of Dictionary<string, string> - which will hold type name and AssemblyQualifiedName.

And run-time based on required type we will get type from AssemblyQualifiedName and then cache it in TypesCache (Like on demand)

Will memory be reduced in new implementation?

When we are preparing cache of TypesCache on application load, will it hold complete type instance or reference of type instance from Loaded Assemblies types?





Aucun commentaire:

Enregistrer un commentaire