cecil
cecil copied to clipboard
Improve the memory consumption of DefaultMetadataImporter
Hi,
We want to unfork cecil in il-repack in https://github.com/gluck/il-repack/pull/236 and we came across an issue with the memory consumption. Basically we merge ~70 dlls into a single dll and during this merge the memory consumption of cecil takes ~3.5GB.
One way we improved the consumption was through a cache in MetadataImporter (now DefaultMetadataImporter) in these commits https://github.com/gluck/cecil/commit/5bca745f545ae047864dd3c7b24e4cf5281c5c60 https://github.com/gluck/cecil/commit/7ea97e072710a17e968c3ee05593e0e840796bc6
This improvement reduced the memory consumption from 3.5Gb (plus System.AccessViolationException) to ~2.0GB. What do you think? Is this cache merge-able in cecil or do you have other ideas to reduce the memory footprint?
Thanks
@jbevain seems like a good idea to me. thoughts?
Either that or enabling IL-Repack to better customize the Import process is a good idea.