@@ -146,14 +146,9 @@ private void DoAnalyseReferenceAssembly(PortableExecutableReference r)
146146 * still be correct.
147147 */
148148
149- // compilation.Clone() reduces memory footprint by allowing the symbols
150- // in c to be garbage collected.
151- Compilation c = compilation . Clone ( ) ;
152-
153-
154- if ( c . GetAssemblyOrModuleSymbol ( r ) is IAssemblySymbol assembly )
149+ if ( compilation . GetAssemblyOrModuleSymbol ( r ) is IAssemblySymbol assembly )
155150 {
156- var cx = new Context ( extractor , c , trapWriter , new AssemblyScope ( assembly , assemblyPath ) , addAssemblyTrapPrefix ) ;
151+ var cx = new Context ( extractor , compilation , trapWriter , new AssemblyScope ( assembly , assemblyPath ) , addAssemblyTrapPrefix ) ;
157152
158153 foreach ( var module in assembly . Modules )
159154 {
@@ -196,7 +191,7 @@ private void DoExtractTree(SyntaxTree tree)
196191
197192 if ( ! upToDate )
198193 {
199- var cx = new Context ( extractor , compilation . Clone ( ) , trapWriter , new SourceScope ( tree ) , addAssemblyTrapPrefix ) ;
194+ var cx = new Context ( extractor , compilation , trapWriter , new SourceScope ( tree ) , addAssemblyTrapPrefix ) ;
200195 // Ensure that the file itself is populated in case the source file is totally empty
201196 var root = tree . GetRoot ( ) ;
202197 Entities . File . Create ( cx , root . SyntaxTree . FilePath ) ;
@@ -236,7 +231,7 @@ private void DoAnalyseCompilation()
236231 var assembly = compilation . Assembly ;
237232 var trapWriter = transformedAssemblyPath . CreateTrapWriter ( Logger , options . TrapCompression , discardDuplicates : false ) ;
238233 compilationTrapFile = trapWriter ; // Dispose later
239- var cx = new Context ( extractor , compilation . Clone ( ) , trapWriter , new AssemblyScope ( assembly , assemblyPath ) , addAssemblyTrapPrefix ) ;
234+ var cx = new Context ( extractor , compilation , trapWriter , new AssemblyScope ( assembly , assemblyPath ) , addAssemblyTrapPrefix ) ;
240235
241236 compilationEntity = Entities . Compilation . Create ( cx ) ;
242237
0 commit comments