Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/oxlint/src/raw_fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use oxc_linter::RuntimeFileSystem;
/// Identical to `OsFileSystem`, except that `read_to_arena_str` reads the file's contents into
/// start of the allocator, instead of the end. This conforms to what raw transfer needs.
///
/// Must only be used in conjunction with `AllocatorPool` with `fixed_size` feature enabled,
/// Must only be used in conjunction with `AllocatorPool` created with `new_fixed_size`,
/// which wraps `Allocator`s with a custom `Drop` impl, which makes `read_to_arena_str` safe.
///
/// This is a temporary solution. When we replace `bumpalo` with our own allocator, all strings
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_linter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description.workspace = true
default = []
ruledocs = ["oxc_macros/ruledocs"] # Enables the `ruledocs` feature for conditional compilation
language_server = ["oxc_data_structures/rope"] # For the Runtime to support needed information for the language server
oxlint2 = ["dep:oxc_ast_macros", "oxc_ast_visit/serialize", "tokio/rt-multi-thread"]
oxlint2 = ["dep:oxc_ast_macros", "oxc_allocator/fixed_size", "oxc_ast_visit/serialize", "tokio/rt-multi-thread"]
disable_oxlint2 = []
force_test_reporter = []

Expand Down
16 changes: 15 additions & 1 deletion crates/oxc_linter/src/service/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,21 @@ impl Runtime {
let _ = rayon::ThreadPoolBuilder::new().build_global();

let thread_count = rayon::current_num_threads();
let allocator_pool = AllocatorPool::new(thread_count);

// If an external linter is used (JS plugins), we must use fixed-size allocators,
// for compatibility with raw transfer
let allocator_pool = if linter.has_external_linter() {
#[cfg(all(feature = "oxlint2", not(feature = "disable_oxlint2")))]
{
AllocatorPool::new_fixed_size(thread_count)
}
#[cfg(not(all(feature = "oxlint2", not(feature = "disable_oxlint2"))))]
{
panic!("`oxlint2` feature must be enabled when using external linters");
}
} else {
AllocatorPool::new(thread_count)
};

let resolver = options.cross_module.then(|| {
Self::get_resolver(options.tsconfig.or_else(|| Some(options.cwd.join("tsconfig.json"))))
Expand Down
Loading