Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 垃圾收集器无法为主堆部分分配16384字节的内存_C#_Mono_Garbage Collection_Xamarin - Fatal编程技术网

C# 垃圾收集器无法为主堆部分分配16384字节的内存

C# 垃圾收集器无法为主堆部分分配16384字节的内存,c#,mono,garbage-collection,xamarin,C#,Mono,Garbage Collection,Xamarin,我正在使用Xamarin Studio在Mac上运行一些C#代码,出现以下错误 Error :Garbage collector could not allocate 16384 bytes of memory for major heap section. 我尝试过在托管堆上设置显式限制,并按照以下建议使用sGen运行: 但我还是有同样的问题 您能告诉我如何解决这个问题吗?确保您没有使用低延迟/持续低延迟GC模式,它们会导致此类问题,也不要使用批处理(我认为这是旧的),除非您知道自己在做什

我正在使用Xamarin Studio在Mac上运行一些C#代码,出现以下错误

Error :Garbage collector could not allocate 16384 bytes of memory for major heap section.
我尝试过在托管堆上设置显式限制,并按照以下建议使用sGen运行:

但我还是有同样的问题

您能告诉我如何解决这个问题吗?

确保您没有使用低延迟/持续低延迟GC模式,它们会导致此类问题,也不要使用批处理(我认为这是旧的),除非您知道自己在做什么。您希望在大多数时间都保持交互式模式。 您可以在此处阅读有关延迟模式的更多信息:

您是否在32位机器/构建上?如果没有完整的项目来检查内存分配的位置和方式,很难提供帮助。我认为公平起见,您需要向我们展示更多的代码,正如Yuri所说。
export MONO_GC_PARAMS=max-heap-size=2g
mono --gc=sgen MyProgram.exe