mirror of
https://github.com/denoland/deno.git
synced 2025-01-11 08:33:43 -05:00
fix(lsp): increase default max heap size to 3Gb (#19115)
This commit is contained in:
parent
cf6f965e25
commit
226a373c49
3 changed files with 20 additions and 5 deletions
|
@ -281,7 +281,13 @@ pub fn main() {
|
||||||
Err(err) => unwrap_or_exit(Err(AnyError::from(err))),
|
Err(err) => unwrap_or_exit(Err(AnyError::from(err))),
|
||||||
};
|
};
|
||||||
|
|
||||||
init_v8_flags(&flags.v8_flags, get_v8_flags_from_env());
|
let default_v8_flags = match flags.subcommand {
|
||||||
|
// Using same default as VSCode:
|
||||||
|
// https://github.com/microsoft/vscode/blob/48d4ba271686e8072fc6674137415bc80d936bc7/extensions/typescript-language-features/src/configuration/configuration.ts#L213-L214
|
||||||
|
DenoSubcommand::Lsp => vec!["--max-old-space-size=3072".to_string()],
|
||||||
|
_ => vec![],
|
||||||
|
};
|
||||||
|
init_v8_flags(&default_v8_flags, &flags.v8_flags, get_v8_flags_from_env());
|
||||||
|
|
||||||
util::logger::init(flags.log_level);
|
util::logger::init(flags.log_level);
|
||||||
|
|
||||||
|
|
|
@ -430,7 +430,7 @@ pub async fn run(
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
v8_set_flags(construct_v8_flags(&metadata.v8_flags, vec![]));
|
v8_set_flags(construct_v8_flags(&[], &metadata.v8_flags, vec![]));
|
||||||
|
|
||||||
let mut worker = worker_factory
|
let mut worker = worker_factory
|
||||||
.create_main_worker(main_module.clone(), permissions)
|
.create_main_worker(main_module.clone(), permissions)
|
||||||
|
|
|
@ -10,17 +10,26 @@ pub fn get_v8_flags_from_env() -> Vec<String> {
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn construct_v8_flags(
|
pub fn construct_v8_flags(
|
||||||
|
default_v8_flags: &[String],
|
||||||
v8_flags: &[String],
|
v8_flags: &[String],
|
||||||
env_v8_flags: Vec<String>,
|
env_v8_flags: Vec<String>,
|
||||||
) -> Vec<String> {
|
) -> Vec<String> {
|
||||||
std::iter::once("UNUSED_BUT_NECESSARY_ARG0".to_owned())
|
std::iter::once("UNUSED_BUT_NECESSARY_ARG0".to_owned())
|
||||||
|
.chain(default_v8_flags.iter().cloned())
|
||||||
.chain(env_v8_flags.into_iter())
|
.chain(env_v8_flags.into_iter())
|
||||||
.chain(v8_flags.iter().cloned())
|
.chain(v8_flags.iter().cloned())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn init_v8_flags(v8_flags: &[String], env_v8_flags: Vec<String>) {
|
pub fn init_v8_flags(
|
||||||
if v8_flags.is_empty() && env_v8_flags.is_empty() {
|
default_v8_flags: &[String],
|
||||||
|
v8_flags: &[String],
|
||||||
|
env_v8_flags: Vec<String>,
|
||||||
|
) {
|
||||||
|
if default_v8_flags.is_empty()
|
||||||
|
&& v8_flags.is_empty()
|
||||||
|
&& env_v8_flags.is_empty()
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +38,7 @@ pub fn init_v8_flags(v8_flags: &[String], env_v8_flags: Vec<String>) {
|
||||||
.chain(v8_flags)
|
.chain(v8_flags)
|
||||||
.any(|flag| flag == "-help" || flag == "--help");
|
.any(|flag| flag == "-help" || flag == "--help");
|
||||||
// Keep in sync with `standalone.rs`.
|
// Keep in sync with `standalone.rs`.
|
||||||
let v8_flags = construct_v8_flags(v8_flags, env_v8_flags);
|
let v8_flags = construct_v8_flags(default_v8_flags, v8_flags, env_v8_flags);
|
||||||
let unrecognized_v8_flags = deno_core::v8_set_flags(v8_flags)
|
let unrecognized_v8_flags = deno_core::v8_set_flags(v8_flags)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.skip(1)
|
.skip(1)
|
||||||
|
|
Loading…
Reference in a new issue