MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    mmap() failed: Cannot allocate memory

    Scheduled Pinned Locked Moved Troubleshooting
    15 Posts 2 Posters 3.7k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E Offline
      Egnos
      last edited by

      @sdetweil said in mmap() failed: Cannot allocate memory:

      the error is no memory

      No memory do you mean RAM or SD memory?

      My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @Egnos
        last edited by

        @Egnos ram technically heap.

        could be a bug in the module or a library it uses

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        1 Reply Last reply Reply Quote 0
        • E Offline
          Egnos
          last edited by

          I found the follow procedure for prevent Raspberry Pi memory allocation failure.

          link

          1. All commands should be issued as root:
          sudo su
          

          1.5) If you have previously uninstalled dphys-swapfile:

          apt-get install dphys-swapfile
          
          1. Set the swap file size to double the amount on RAM:
          echo "CONF_SWAPSIZE=512" > /etc/dphys-swapfile
          dphys-swapfile setup
          

          If you have 512 MB RAM on the Pi then set swapsize to 1024.

          1. Enable swap
          dphys-swapfile swapon
          
          1. Exit the root shell
          exit
          

          And that’s it.

          Could be the solution to use the SWAP file?

          My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

          S 1 Reply Last reply Reply Quote 0
          • S Offline
            sdetweil @Egnos
            last edited by

            @Egnos maybe. but I don’t know if you ever constrained before. one of the commands I asked for results from was the memory free command
            free -m

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            1 Reply Last reply Reply Quote 0
            • E Offline
              Egnos
              last edited by

              @sdetweil said in mmap() failed: Cannot allocate memory:

              no idea… would take a bit of debugging

              in a terminal window do
              free -m
              lsb_release -a
              uname -a

              As requested:

              pi@MagicMirror:~ $ lsb_release -a
              No LSB modules are available.
              Distributor ID:	Raspbian
              Description:	Raspbian GNU/Linux 10 (buster)
              Release:	10
              Codename:	buster
              
              pi@MagicMirror:~ $ uname -a
              Linux MagicMirror 5.4.79-v7+ #1373 SMP Mon Nov 23 13:22:33 GMT 2020 armv7l GNU/Linux
              
              

              Sometimes the message “mmap() failed: Cannot allocate memory” appears before the RAM saturation, no longer allowing MMM-GoogleAssistant to be able to launch searches on YouTube, etc …
              Sometimes the error appears shortly after starting MM sometimes after a long time.
              In the Sound page of @Bugsounet I read that the choice of the audio player could give these problems (“With HTML5, some device have some trouble with sound output (no sound output, only chime, mmap memory issue,…)”) but I have already done some tests and the only one that works is “mpg321”.

              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         452          95          43         376         373
              Swap:            99           8          91
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         455          58         253         411         165
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         462          48         254         413         157
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         463          48         253         413         157
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         465          35         263         424         145
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         466          47         249         410         158
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         470          43         249         410         153
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         471          31         261         422         142
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         468          53         248         403         157
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         467          56         246         400         161
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         465          55         249         403         160
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         467          32         270         425         136
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         468          31         270         424         136
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         469          30         270         424         135
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         469          29         271         426         134
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         469          31         272         423         133
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         471          47         254         405         149
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         473          44         254         406         147
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         473          44         254         406         147
              Swap:            99          84          15
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         507          46         252         371         114
              Swap:            99          96           3
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         513          37         255         374         105
              Swap:            99          96           3
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         508          37         260         379         105
              Swap:            99          96           3
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         508          36         260         379         105
              Swap:            99          96           3
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         540          37         254         347          79
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         540          37         254         346          79
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         540          37         254         346          79
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         528          48         254         348          91
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         455         120         248         348         170
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         465          60         269         398         141
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         465          60         268         398         141
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         494          35         253         394         122
              Swap:            99          99           0
              pi@MagicMirror:~ $ free -m
                            total        used        free      shared  buff/cache   available
              Mem:            924         495          54         251         374         127
              Swap:            99          99           0
              
              
              mmap() failed: Impossibile allocare memoria
              mmap() failed: Impossibile allocare memoria
              mmap() failed: Impossibile allocare memoria
              mmap() failed: Impossibile allocare memoria
              mmap() failed: Impossibile allocare memoria
              ^[[Ammap() failed: Impossibile allocare memoria
              mmap() failed: Impossibile allocare memoria
              mmap() failed: Impossibile allocare memoria
              
              

              Would you have the patience to help me?

              Many Thanks.

              My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                sdetweil @Egnos
                last edited by

                @Egnos said in mmap() failed: Cannot allocate memory:

                Mem: 924 495 54 251 374 127
                Swap: 99 99

                u always have memory available, and never consume any swap space…

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                E 1 Reply Last reply Reply Quote 0
                • E Offline
                  Egnos @sdetweil
                  last edited by

                  @sdetweil

                  pi@MagicMirror:~ $ free -m
                                total        used        free      shared  buff/cache   available
                  Mem:            924         495          54         251         374         127
                  Swap:            99          99           0
                  
                  

                  I see that all swap memory is finished … “Used =99 and free=0”.
                  I dont understand why it is already using swap memory if it is not out of RAM yet …

                  Why the swap memory always occupied?
                  Finished the task shouldn’t it free itself?

                  My Mirror https://forum.magicmirror.builders/topic/17262/the-raspimirror-was-born/7

                  S 3 Replies Last reply Reply Quote 0
                  • S Offline
                    sdetweil @Egnos
                    last edited by sdetweil

                    @Egnos try this

                    for file in /proc/*/status ; do awk '/VmSwap|Name/{printf $2 " " $3}END{ print ""}' $file; done | sort -k 2 -n -r | less
                    

                    should give a list of processes using swap, most to least

                    Sam

                    How to add modules

                    learning how to use browser developers window for css changes

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      sdetweil @Egnos
                      last edited by

                      @Egnos so, I would make the swap bigger just for for testing 1 gig

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @Egnos
                        last edited by

                        @Egnos try this

                        pm2 stop all
                        export NODE_OPTIONS=--max_old_space_size=4096
                        npm start
                        

                        u can add that export line to the installers/mm.sh
                        if using pm2

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0
                        • 1
                        • 2
                        • 1 / 2
                        • First post
                          Last post
                        Enjoying MagicMirror? Please consider a donation!
                        MagicMirror created by Michael Teeuw.
                        Forum managed by Sam, technical setup by Karsten.
                        This forum is using NodeBB as its core | Contributors
                        Contact | Privacy Policy