GC and allocations?

BlueMoo 3 years ago updated 3 years ago 2

I am really excited to start using Bolt as a core part of my project. However, I immediately noticed that it tends to generate a bit of garbage when doing simple things like sampling a few floats each frame. This seems to be true whether sampling from a field or property. Can anyone shed some light on this? I was planning to move a fair amount of stuff into bolt but have already started hitting those darned GC.Collect invocations in my Flow Graphs fairly often.

Many thanks in advance,

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Hi BlueMoo, welcome to the community! :) 

Unfortunately, this is a small alloc due to boxing (not instantiation) that cannot be avoided in the current version.

This is one of the reasons why Bolt 2 will generate C# script files for maximum performance (and minimum allocation).

However, in the mean time, such a small allocation is usually not a problem, unless you use Bolt on low-end mobile with tons of objects.


Hi Lazlo,

Thanks for the warm welcome and the heads up. It's good to just understand the underlying issue. (I had a good root through the dll and presumed as much since everything seems to be cached about as effectively as it possibly can be, nice job!)