# Constant out of memory error of VSCode extension

**URL:** <https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323>\
**Category:** VS Code\
**Tags:** linux, cluster, vscode, languageserver\
**Created:** [July 7, 2023, 6:43pm UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323 "2023-07-07T18:43:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![wujinq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wujinq/32/22221_2.png) [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Post date:** [July 7, 2023, 6:43pm UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/1 "2023-07-07T18:43:44Z")

</div>

So I use VSCode to login in to the supercomputer I’m working with, and I installed the Julia extension on it. It works well, but recently I noticed that the following error appears frequently:

```bash
[ Info: Loading GPUArraysCore from cache... (50%)
[ Info: Loading Adapt from cache... (50%)
[ Info: Loading Measures from cache... (50%)
[ Info: Loading FFMPEG from cache... (50%)
[ Info: Loading BinaryProvider from cache... (50%)
[ Info: Loading PlotThemes from cache... (50%)
[ Info: Loading Contour from cache... (50%)
[ Info: Loading LaTeXStrings from cache... (75%)
[ Info: Received new data from Julia Symbol Server.
Internal error: encountered unexpected error in runtime:
OutOfMemoryError()
jl_gc_alloc_new_page at /home1/***/julia/src/gc-pages.c:163 [inlined]
jl_gc_alloc_page at /home1/***/julia/src/gc-pages.c:222
add_page at /home1/***/julia/src/gc.c:1422

```

As you can see, this usually happens when the language server loads all packages installed. After the error the language server closes and restarts.

I don’t really have lots of packages installed actually: below is a list of installed packages:

```bash
Status `~/.julia/environments/v1.9/Project.toml`
  [f67ccb44] HDF5 v0.16.15
  [b964fa9f] LaTeXStrings v1.3.0
⌃ [8314cec4] PGFPlotsX v1.5.1
⌃ [91a5bcdd] Plots v1.15.2

```

What’s the root cause of this? It’s hard to imagine that indexing so few packages can cause a memory problem. Is there any way to solve this?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 7, 2023, 7:47pm UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/2 "2023-07-07T19:47:43Z")

</div>

how much memory do you actually have?

---

<div class="post-metadata">

**Author:** ![wujinq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wujinq/32/22221_2.png) [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Post date:** [July 8, 2023, 1:07am UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/3 "2023-07-08T01:07:33Z")

</div>

One login node has 192GB RAM in total but that’s shared by users. Also,

```julia
julia> Sys.total_memory() / 2^20
191724.78515625

julia> Sys.free_memory() / 2^20
169993.390625

```

I guess that’s the total memory allocated to one user?

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [July 8, 2023, 3:19am UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/4 "2023-07-08T03:19:00Z")

</div>

I suppose it’s possible system admin sets some kind of cap that’s smaller than

> [@wujinq](#):
>
> `Sys.free_memory()`

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 8, 2023, 6:18am UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/5 "2023-07-08T06:18:50Z")

</div>

Did you try to launch Julia with the parameter:

```julia
 --heap-size-hint=<size> Forces garbage collection if memory usage is higher than that value.
                            The memory hint might be specified in megabytes(500M) or gigabytes(1G)

```

---

<div class="post-metadata">

**Author:** ![wujinq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wujinq/32/22221_2.png) [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Post date:** [July 8, 2023, 8:27pm UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/6 "2023-07-08T20:27:04Z")

</div>

Thanks for the suggestion - can you tell me how to configure this for the Julia language server used in the VSCode extension?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 9, 2023, 4:31am UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/7 "2023-07-09T04:31:32Z")

</div>

That is not straightforward. You could try to confiigure `julia.executablePath `and put a script in that directory that calls julia with the correct parameters…

And create an issue in vscode: [GitHub - julia-vscode/julia-vscode: Julia extension for Visual Studio Code](https://github.com/julia-vscode/julia-vscode)

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [July 11, 2023, 4:32pm UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/8 "2023-07-11T16:32:12Z")

</div>

Do you have any large files in your current workspace? E.g. files generated by MTK.jl or something?

---

<div class="post-metadata">

**Author:** ![wujinq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wujinq/32/22221_2.png) [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Post date:** [July 13, 2023, 11:49pm UTC](https://discourse.julialang.org/t/constant-out-of-memory-error-of-vscode-extension/101323/9 "2023-07-13T23:49:10Z")

</div>

Yes - plenty of them. I use Julia together with QuantumESPRESSO and BerkeleyGW, so there are always lots of large (~100G) wave function files.
