System.GC.Collect(); ?

Guy Rabiller 4 years ago updated by Lazlo Bonin (Lead Developer) 4 years ago 10


What should I do to find/access GC node to force/trigger GC collection as in C#:


I've added System assembly but can't find any GC node Collect or something.


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

Try adding GC to your custom type options in the next page!

Right, of course, stupid me.

Ok so I get a GC Handle, some methods but no Collect() one. It seems I get a GC object with methods to act on a specific target but no object that can do a global GC.Collect().

You can't search for it, since "GC" is less than the three character minimum for the finder.  However, you should find it under "System" if you search manually.  Once it is added, you can search for Collect, or navigate to Codebase->System->GC.

@Reality.Stop(), I was searching with "GC " which kind of work but I still can't find what you got. There is no GC under my Codebase->System.

Which assemblies did you add if any ?

So I've redone it from scratch, creating a new project.

First I add the "System" assembly:

Then, for the Types, I go to "System":

Then I try to locate "GC" in the "System" types list but:

No "GC" as you can see.

I must be blind or do something really stupid but I do not understand where you get the "GC Collect" node from.. ?

Perhaps a "for dummy" step by step instructions would be appropriate.. Thanks.

According to the Microsoft documentation, GC is part of the mscorlib.dll assembly and in the "System" namespace, so I shouldn't even add the "System" assembly.

that is correct.  I do not have System in my assemblies. 

Are you in .Net 4.6?  Maybe that's affecting it.  (Honestly don't know)

Yep, tried with .Net 4.6, same issue.

What I've noted by comparing with the list of types in mscorlib.dll from VisualStudio Objects Explorer view is that the Bolt types selection list does not show public static classes from the assembly.

For instance, in mscorlib.dll there are GC, Environment, Convert, etc.. classes declared as "public static classes" and they do not show up in the Bolt types selection list/fuzzy explorer.

Perhaps you did something, an option somewhere to activate the listing of such classes in the Bolt types selection list ?

Ok, I've found the issue..

"public static classes" are filtered out by the Ludiq -> Project Settings -> AOT Safe mode.

Disabling this option makes GC, Convert, Environment, etc.. public static classes to appear in the Bolt types selector list..

Ah, sorry about this!

Started a new thread specifically regarding that bug, because it's different:


Thanks for the report, really helps! And I'm glad you got it working!