SciML / RuntimeGeneratedFunctions.jl

Functions generated at runtime without world-age issues or overhead
https://docs.sciml.ai/RuntimeGeneratedFunctions/stable/
MIT License
100 stars 14 forks source link

Allow function body ASTs to be GC'd #9

Closed c42f closed 4 years ago

c42f commented 4 years ago

This moves the function body AST into the RuntimeGeneratedFunction itself, and caches the function object itself, but only holds it in the cache via a WeakRef, thus ensuring that it can be GC'd as normal. (A slight wart with this approach is that the id is still present in the cache after GC has run.)

As a side effect, this makes accessing the body in normal non-generated functions a lot neater.

codecov[bot] commented 4 years ago

Codecov Report

Merging #9 into master will increase coverage by 0.34%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #9      +/-   ##
==========================================
+ Coverage   89.65%   90.00%   +0.34%     
==========================================
  Files           1        1              
  Lines          29       30       +1     
==========================================
+ Hits           26       27       +1     
  Misses          3        3              
Impacted Files Coverage Δ
src/RuntimeGeneratedFunctions.jl 90.00% <100.00%> (+0.34%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e51174f...e186934. Read the comment docs.