簡體   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