How do I guarantee that the CLR's JIT "method" cache has been cleared? Is it simply a matter of starting a new instance of the application, or do you have to re-boot the PC?
It is my understanding the the CLR JIT is process specific, and that this should work.
Foobar.exe
is started.DoWork()
is invoked for the first time- CLR's JIT compiler converts the intermediate language (for
DoWork()
) to machine code - the generated machine code is cached in-memory for future calls
- CLR's JIT compiler converts the intermediate language (for
DoWork()
is called again, and existing machine code is used. (i.e. JIT is bypassed)- Terminate
Foobar.exe
application.- there are no instances of
Foobar.exe
running
- there are no instances of
Foobar.exe
is started again.DoWork()
is invoked for the first time- Terminating the previous application, and starting a new instance effectively cleared the JIT "method" cache.
- CLR's JIT compiler converts the intermediate language (for
DoWork()
) to machine code - the generated machine code is cached in-memory for future calls
DoWork()
is called again, and existing machine code is used. (i.e. JIT is bypassed)
Any feedback that can be provided would be greatly appreciated.
Environment
- Windows IOT Enterprise (LTSC 2019), 64-bit
- Application currently targeting: .Net library 4.7.2, CLR 4.x
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
- to the best of my knowledge, we are not using .Net core
- We are not explicitly using NGen