[Mono-dev] Will mono_gc_collect(0) recycle all the garbage object?

xiaozhu niluzhou1984 at foxmail.com
Thu May 17 07:05:51 UTC 2018

    I have write some experimental code 

   #include <string.h>
   #include <vector>
   #include <cstdio>
   using namespace std;

    int main(int argc,char* argv[]) {

	MonoDomain *domain;
	domain = mono_jit_init_version("Unity Root Domain", "v4.0.30319");

	auto assembly = mono_domain_assembly_open(domain, "C:\\Users\\Administrator\\source\\repos\\AssemblyForDemo\\MainEntry\\bin\\Debug\\MainEntry.exe");
	int retval = mono_jit_exec(domain, assembly, argc - 1, argv + 1);
	return 0;

   The MainEntry.exe will generate two garbage objects, the garbage object will print some message when garbaged.
   But the result sometimes is remove nothing , sometimes remove two and sometimes remove one

   If I run the MainEntry.exe using the mono.exe, all the garbage object will be recycled.

                                                                                               Thank You
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20180517/cfb3aad1/attachment.html>

More information about the Mono-devel-list mailing list