mirror of
https://github.com/urbit/ares.git
synced 2024-12-23 05:12:15 +03:00
Add feature flag to shut off OOM checks
This commit is contained in:
parent
14124d804e
commit
750af65527
@ -43,3 +43,4 @@ check_junior = []
|
|||||||
sham_hints = []
|
sham_hints = []
|
||||||
stop_for_debug = []
|
stop_for_debug = []
|
||||||
hint_dont = []
|
hint_dont = []
|
||||||
|
no_oom_check = []
|
||||||
|
@ -294,6 +294,12 @@ impl NockStack {
|
|||||||
// Directionality parameters: (East/West), (Stack/Alloc), (pc: true/false)
|
// Directionality parameters: (East/West), (Stack/Alloc), (pc: true/false)
|
||||||
// Types of size: word (words: usize)
|
// Types of size: word (words: usize)
|
||||||
/// Check if an allocation or pointer retrieval indicates an invalid request or an invalid state
|
/// Check if an allocation or pointer retrieval indicates an invalid request or an invalid state
|
||||||
|
#[cfg(feature = "no_oom_check")]
|
||||||
|
pub const fn alloc_would_oom_(&self, alloc: Allocation, words: usize) -> AllocResult<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "no_oom_check"))]
|
||||||
pub fn alloc_would_oom_(&self, alloc: Allocation, words: usize) -> AllocResult<()> {
|
pub fn alloc_would_oom_(&self, alloc: Allocation, words: usize) -> AllocResult<()> {
|
||||||
let _memory_state = self.memory_state(Some(words));
|
let _memory_state = self.memory_state(Some(words));
|
||||||
if self.pc && !alloc.alloc_type.allowed_when_pc() {
|
if self.pc && !alloc.alloc_type.allowed_when_pc() {
|
||||||
|
Loading…
Reference in New Issue
Block a user