pertsevds

pertsevds

: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?

Showing Posts 1 to 10

dimitarvp

dimitarvp

Does that reply by one of Erlang’s maintainers help?

pertsevds

pertsevds OP

App is not in a container.

In vm.args:

+P 1024 - max processes 1024
+Q 1024 - max ports 1024

Both does not help.

Still the same 4G.

OS: Debian 10.
Elixir 1.15.
Erlang 26.0.2.

dimitarvp

dimitarvp

Did you read the BEAM VM option he linked to? This is not about containers, it’s an option that should work regardless of where the app is started.

pertsevds

pertsevds OP

ERL_MAX_PORTS does not help.

I just tired +MIscs +MIscs 128 and mem usage dropped to 3188MB.

dimitarvp

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.

garazdawi

garazdawi

Erlang Core Team

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.

garazdawi

garazdawi

Erlang Core Team

The statistics for the Erlang allocators do not indicate that you are using a lot of virtual memory. What does :erlang.system_info({:allocator,:erts_mmap}) return?

pertsevds

pertsevds OP

[
  default_mmap: [options: [scs: 0], os: [sizes: [used: 29888512]]],
  literal_mmap: [
    options: [scs: 1073676288, sco: true, scrpm: false, scrfsd: 1024],
    supercarrier: [
      sizes: [
        total: 1073741824,
        total_sa: 4096000,
        total_sua: 0,
        used: 4161536,
        used_sa: 4096000,
        used_sua: 0
      ],
      free_segs: [
        used: 0,
        max: 0,
        allocated: 0,
        reserved: 1024,
        used_sa: 0,
        used_sua: 0
      ]
    ]
  ]
]
pertsevds

pertsevds OP

Summary from /proc/16025/smaps where 16025 - beam pid.

* Mem usage for PID 16025
-- Size: 4172764 kB
-- Rss: 135352 kB
-- Pss: 113538 kB
Shared Clean 5440 kB
Shared Dirty 34504 kB
Private 95412 kB

Some very strange region

VmFlags: rd wr mr mw me ac sd
7f659a834000-7f65da43b000 ---p 00000000 00:00 0
Size:            1044508 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                   0 kB
Pss:                   0 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Anonymous:             0 kB
LazyFree:              0 kB
AnonHugePages:         0 kB
ShmemPmdMapped:        0 kB
Shared_Hugetlb:        0 kB
Private_Hugetlb:       0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
THPeligible:    1
ProtectionKey:         0

And many empty regions with the size 65504 kB

VmFlags: rd wr mr mw me nr sd
7f6530008000-7f6534000000 ---p 00000000 00:00 0
Size:              65504 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                   0 kB
Pss:                   0 kB
Shared_Clean:          0 kB
Shared_Dirty:          0 kB
Private_Clean:         0 kB
Private_Dirty:         0 kB
Referenced:            0 kB
Anonymous:             0 kB
LazyFree:              0 kB
AnonHugePages:         0 kB
ShmemPmdMapped:        0 kB
Shared_Hugetlb:        0 kB
Private_Hugetlb:       0 kB
Swap:                  0 kB
SwapPss:               0 kB
Locked:                0 kB
THPeligible:    1
ProtectionKey:         0

My script for summary:

#!/bin/bash

pid=$1

echo "* Mem usage for PID $pid"
sz=$(awk 'BEGIN {i=0} /^Size/ {i = i + $2} END {print i}' /proc/$pid/smaps)
rss=$(awk 'BEGIN {i=0} /^Rss/ {i = i + $2} END {print i}' /proc/$pid/smaps)
pss=$(awk 'BEGIN {i=0} /^Pss/ {i = i + $2 + 0.5} END {print i}' /proc/$pid/smaps)
sc=$(awk 'BEGIN {i=0} /^Shared_Clean/ {i = i + $2} END {print i}' /proc/$pid/smaps)
sd=$(awk 'BEGIN {i=0} /^Shared_Dirty/ {i = i + $2} END {print i}' /proc/$pid/smaps)
pc=$(awk 'BEGIN {i=0} /^Private_Clean/ {i = i + $2} END {print i}' /proc/$pid/smaps)
pd=$(awk 'BEGIN {i=0} /^Private_Dirty/ {i = i + $2} END {print i}' /proc/$pid/smaps)
echo "-- Size: $sz kB"
echo "-- Rss: $rss kB"
echo "-- Pss: $pss kB"
echo "Shared Clean $sc kB"
echo "Shared Dirty $sd kB"
echo "Private $(($pd + $pc)) kB"

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews