How to trigger the garbage collector from "freeing objects out from under youobjects out from under you"

https://docs.julialang.org/en/v1/manual/embedding/index.html the docs and the general advice is to always root all values you are using from C. But when I comment out my code that roots values, everything still works exactly as before. Can someone please give me an example that will for sure free values that are still in use if unrooted?

The code I tried is

  • allocate value
  • 100 times: allocate array
  • access value

but the value is fine at the end :thinking:. Thank you!