pertsevds
BEAM VM consumes big amounts of memory VIRT vs :erlang.memory(:total)
:erlang.memory(:total) shows 54877864,
VIRT shows 4G.
When I do ulimit -Sv 1048576 app just fails to start with error:
erts_mmap: Failed to create super carrier of size 1024 MB.
+MMscs 64
+MMsco true
+MMscrpm true
+Musac false
in vm.args does not reduce VIRT memory amount.
Searched this forum - found nothing of use.
Are there are any methods to reduce it?
Marked As Solved
garazdawi
I may have figured it out. It is the malloc arenas that are using all the extra virtual memory.
If I set MALLOC_ARENA_MAX=1 then the virtual memory usage on my machine drops by a lot.
It is this allocation that causes malloc to create an arena on each thread.
That being said, I’m not sure we will do anything about this. Virtual memory does not cost anything, except that limits placed on it will have to be adjusted as you have noticed.
Also Liked
garazdawi
I would use recon_alloc — recon v2.5.3 to get a view of what is using memory. Especially recon_alloc:fragmentation/1 can be helpful to look at.
If you can provide a recon_alloc snapshot I can see if I can figure out what is using all the extra virtual memory.
dimitarvp
Glad you guys figured it out!
@garazdawi is absolutely precious.
dimitarvp
Hm, seems there is more that can be done but I am not aware of it, sorry.
Wonder if @garazdawi would be willing to help further.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









