alda-lang / alda

A music programming language for musicians. :notes:
https://alda.io
Eclipse Public License 2.0
5.61k stars 288 forks source link

Alda suddenly consume a huge amount of RAM #410

Open tsklxiv opened 2 years ago

tsklxiv commented 2 years ago

🐞 Bug report 🐞

Description

When left open the alda's REPL for a very short amount of time, suddenly it consumes a huge amount of RAM at rapid speed (~1.5 gigabytes).

Steps to Reproduce

  1. Start alda repl
  2. Leave open for a while

Does the problem happen consistently?

Yes

Is there anything else that it would be useful for us to know?

This also seems to happen when run alda ps and alda-player info. When I opened up htop it also shows that there are a lot of alda processes.

wth_alda

Expected Behavior

The alda REPL starts normally and doesn't consume huge amount of RAM.

Actual Behavior

The alda REPL starts normally, but then consumes a huge amount of RAM.

Environment

OS: Ubuntu (Pop!_OS 21.10 x86_64) Alda installed through Homebrew.

Alda version:

$ alda version
alda 2.2.0
$ alda-player info
alda-player 2.2.0
log path: /home/firefly/.cache/alda/logs

Health check:

$ alda doctor
OK  Parse source code
OK  Generate score model
OK  Ensure that there are no stale player processes
OK  Find an open port
OK  Send and receive OSC messages
OK  Locate alda-player executable on PATH
OK  Check alda-player version
OK  Spawn a player process
OK  Ping player process
OK  Play score
OK  Export score as MIDI
OK  Locate player logs
OK  Player logs show the ping was received
OK  Shut down player process
OK  Spawn a player on an unknown port
OK  Discover the player
OK  Ping the player
OK  Shut the player down
OK  Start a REPL server
nREPL server started on port 43725 on host localhost - nrepl://localhost:43725
OK  Find the REPL server
OK  Interact with the REPL server
OK  Shut down the REPL server

Logs:

daveyarwood commented 2 years ago

Hi @HoangTuan110 , thanks for reporting this! I have previous noted this as a concern that makes Alda difficult to run on Raspberry Pi (#403)

I think the solution is to include some JVM options when we are starting the alda-player Java processes, to use less memory. This is not my strong suit, so I would really appreciate if anyone could offer suggestions about JVM options that we could use!