oxc-project/oxc · warning

Insufficient memory to create fixed-size allocator pool

Error message

Insufficient memory to create fixed-size allocator pool

What it means

Diagnostic from oxlint's vue/require-default-prop rule (crates/oxc_linter/src/rules/vue/require_default_prop.rs). Every prop that is not marked `required: true` must declare a `default`, in Options API `props` objects and in runtime `defineProps({...})` declarations. Optional props without a default resolve to `undefined`, pushing null-handling onto every consumer template. The rule knows Vue's native constructor types (String, Number, Boolean, Function, Object, Array, Symbol).

Source

Thrown at crates/oxc_allocator/src/pool/fixed_size.rs:170

        let mut allocators = Stack::with_capacity(capacity);

        // Get as many allocators as possible, up to `capacity`
        for i in 0..capacity {
            // It's impossible to create more than `u32::MAX` allocators, as `u32::MAX` x 4 GiB allocations would
            // consume almost the entirety of a 64-bit address space. No platform has such a large address space.
            // Typically they use 48 bit address space, or 53 bit at most.
            #[expect(clippy::cast_possible_truncation)]
            let allocator = FixedSizeAllocator::try_new(i as u32);
            let Ok(allocator) = allocator else { break };
            allocators.push(allocator);
        }

        // Discard last allocator if we have more than 1.
        // This leaves pool containing between 1 and `thread_count` allocators.
        match allocators.len() {
            // If we can't create even 1 allocator, panic
            0 => panic!("Insufficient memory to create fixed-size allocator pool"),
            // If we only got 1, keep it.
            // If system has just over 4 GiB memory available in total, OOM is possible later.
            // But what else can we do in this case?
            1 => {}
            // Otherwise, discard the last allocator we got, to leave memory free for other allocations
            _ => {
                allocators.pop();
            }
        }

        Self { allocators: Mutex::new(allocators), available: Condvar::new() }
    }

    /// Retrieve an [`Allocator`] from the pool.
    ///
    /// Linux/Mac implementation.
    ///
    /// # Panics

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Add a `default` for the prop: `title: { type: String, default: '' }`.
  2. If the prop must be provided, mark `required: true` instead of adding a default.
  3. Remember Object/Array defaults must be factory functions: `default: () => []`.
  4. If optional-without-default is an accepted team pattern, disable the rule or suppress it inline with a comment.

Example fix

// before
export default {
  props: { title: { type: String } }
}

// after
export default {
  props: { title: { type: String, default: '' } }
}
Defensive patterns

Strategy: validation

Validate before calling

// validate a props definition before exporting the component
function checkPropDefaults(defs) {
  for (const [name, def] of Object.entries(defs)) {
    const d = typeof def === 'object' && def !== null ? def : { type: def };
    if (!d.required && !('default' in d)) {
      throw new Error(`prop '${name}' needs required:true or a default`);
    }
  }
}

Prevention

When it happens

Trigger: Declaring `props: { title: { type: String } }` or `defineProps({ count: Number })` — the prop is optional (no `required: true`) yet has no `default` key. Adding `required: true` or a `default` entry silences the report.

Common situations: Converting required props to optional during refactor and forgetting the fallback; inconsistent optional-prop styles across a component library; TS codebases where optionality comes from the type signature but runtime object entries still need defaults.

Related errors


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/562a9ed1d6f6336a. Report an issue: GitHub.