繁体   English   中英

没有记录Mono GC的最大堆大小。 在生产中使用安全吗?

[英]Mono GC max-heap-size isn't documented. Is it safe to use in production?

我需要为Mono使用的内存设置一个上限。

根据博客的说法,可以使用参数max-heap-size来限制内存使用量。 根据实验和代码 ,它确实可以实现我想要的功能。

但是, 未记录此选项。

因此:在生产中依靠此选项是否安全(或者它具有我看不见的缺点,例如:无法保证在将来的Mono版本中仍然可用)?

已记录了文档,这是获取文档的一种方法: export无效的MONO_GC_PARAMS ,启动mono

export MONO_GC_PARAMS=xxx
mono sample.exe

并获得帮助:

Warning: In environment variable `MONO_GC_PARAMS': Unknown option `xxx`. - Ignoring.

MONO_GC_PARAMS must be a comma-delimited list of one or more of the following:
  max-heap-size=N (where N is an integer, possibly with a k, m or a g suffix)
  soft-heap-limit=n (where N is an integer, possibly with a k, m or a g suffix)
  nursery-size=N (where N is an integer, possibly with a k, m or a g suffix)
  major=COLLECTOR (where COLLECTOR is `marksweep', `marksweep-conc', `marksweep-par', 'marksweep-fixed' or 'marksweep-fixed-par')
  minor=COLLECTOR (where COLLECTOR is `simple' or `split')
  wbarrier=WBARRIER (where WBARRIER is `remset' or `cardtable')
  stack-mark=MARK-METHOD (where MARK-METHOD is 'precise' or 'conservative')
  [no-]cementing
  evacuation-threshold=P (where P is a percentage, an integer in 0-100)
  (no-)lazy-sweep
 Experimental options:
  save-target-ratio=R (where R must be between 0.10 - 2.00).
  default-allowance-ratio=R (where R must be between 1.00 - 10.00).

如您所见,列出了max-heap-size ,而不是在Experimental Options 所以我说这很安全。

它记录在mono手册页中

设置堆的最大大小。 该大小以字节为单位指定,并且必须为2的幂。 后缀“ k', m”和“ g”可分别用于指定千字节,兆字节和千兆字节。 限制是托儿所,主要堆和大对象堆的总和。 一旦达到限制,应用程序将在尝试分配时收到OutOfMemoryExceptions。 由于内部碎片,不能以max-heap-size设置全部内存范围来满足单个分配。 默认情况下,禁用堆限制,并且GC将尝试使用所有可用内存。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM