What happened if I invoke a static managed function by FunctionPointer in bursted code?

Normally, I use functionPointer like this

JumpFunc = BurstCompiler.CompileFunctionPointer<ScopeCalculator.JumpDelegate>(ScopeCalculator.GetMotherScope);

And I invoke JumpFunc in bursted code.That worked.
Today I try to convert managed delegate to functionPointer like this

ScopeCalculator.JumpDelegate newDelegate =
                    new ScopeCalculator.JumpDelegate(ScopeCalculator.GetMotherScopeManaged);
JumpFunc = new FunctionPointer<ScopeCalculator.JumpDelegate>(
                    Marshal.GetFunctionPointerForDelegate(newDelegate));

It worked too, and I can use managed type such as string in GetMotherScopeManaged. There is no burst compile error, and I confirmed the code which invoke this functionPointer is bursted.

So is there any problem in this way Like causing memory leak or something woring?

The only gotcha is that you need to make sure you keep that managed delegate referenced by something so that the GC doesn’t pick it up.

But yes, this is supported, and the Entities package does this in a few locations internally.

Thanks. I’ll be care of the delegate reference.