qsharp-compiler
qsharp-compiler copied to clipboard
Clean up and caching for callables during QIR generation
I started some clean up a while back as a prep for potentially using stack allocations more extensively. I didn't really have time to get as far as I wanted, but let me put what I have up.
/azp run
Azure Pipelines successfully started running 2 pipeline(s).
Some feedback and questions above, but nothing that I think should be blocking. The callable memory leak is a little worrisome, but does not appear to be a new problem due to these changes.
@swernli Nothing should get leaked (actually I think the clean up should also clean up the memory management for targeted QIR, even though that is largely irrelevant since it is going to get stripped by subsequent compilation in any case). I responded to the concrete case of callable %8 in your comment above, which is stored in a tuple and should be released as part of that (i.e. the memory management can be hard to read due to the caching optimizations which can cause the deallocations to happen via unexpected handles).