xref: /freebsd/contrib/llvm-project/compiler-rt/lib/scudo/standalone/flags.inc (revision 19fae0f66023a97a9b464b3beeeabb2081f575b3)
1//===-- flags.inc -----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef SCUDO_FLAG
10#error "Define SCUDO_FLAG prior to including this file!"
11#endif
12
13SCUDO_FLAG(int, quarantine_size_kb, 0,
14           "Size (in kilobytes) of quarantine used to delay the actual "
15           "deallocation of chunks. Lower value may reduce memory usage but "
16           "decrease the effectiveness of the mitigation.")
17
18SCUDO_FLAG(int, thread_local_quarantine_size_kb, 0,
19           "Size (in kilobytes) of per-thread cache used to offload the global "
20           "quarantine. Lower value may reduce memory usage but might increase "
21           "the contention on the global quarantine.")
22
23SCUDO_FLAG(int, quarantine_max_chunk_size, 0,
24           "Size (in bytes) up to which chunks will be quarantined (if lower "
25           "than or equal to).")
26
27SCUDO_FLAG(bool, dealloc_type_mismatch, false,
28           "Terminate on a type mismatch in allocation-deallocation functions, "
29           "eg: malloc/delete, new/free, new/delete[], etc.")
30
31SCUDO_FLAG(bool, delete_size_mismatch, true,
32           "Terminate on a size mismatch between a sized-delete and the actual "
33           "size of a chunk (as provided to new/new[]).")
34
35SCUDO_FLAG(bool, zero_contents, false, "Zero chunk contents on allocation.")
36
37SCUDO_FLAG(bool, pattern_fill_contents, false,
38           "Pattern fill chunk contents on allocation.")
39
40SCUDO_FLAG(bool, may_return_null, true,
41           "Indicate whether the allocator should terminate instead of "
42           "returning NULL in otherwise non-fatal error scenarios, eg: OOM, "
43           "invalid allocation alignments, etc.")
44
45SCUDO_FLAG(int, release_to_os_interval_ms, SCUDO_ANDROID ? INT32_MIN : 5000,
46           "Interval (in milliseconds) at which to attempt release of unused "
47           "memory to the OS. Negative values disable the feature.")
48
49SCUDO_FLAG(int, hard_rss_limit_mb, 0,
50           "Hard RSS Limit in Mb. If non-zero, once the limit is achieved, "
51           "abort the process")
52
53SCUDO_FLAG(int, soft_rss_limit_mb, 0,
54           "Soft RSS Limit in Mb. If non-zero, once the limit is reached, all "
55           "subsequent calls will fail or return NULL until the RSS goes below "
56           "the soft limit")
57
58SCUDO_FLAG(int, allocation_ring_buffer_size, 32768,
59           "Entries to keep in the allocation ring buffer for scudo.")
60