Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Potential Memory Leak #98

Open
djipco opened this issue Sep 17, 2024 · 3 comments
Open

Potential Memory Leak #98

djipco opened this issue Sep 17, 2024 · 3 comments

Comments

@djipco
Copy link

djipco commented Sep 17, 2024

A potential memory leak issue was reported to me by a user of the WEBMIDI.js library. This library uses jzz in the Node.js environment to emulate the Web MIDI API.

Based on the info reported by the user, I ran the following script to troubleshoot the problem:

const express = require('express');
const navigator = require('jzz');

// jzz
navigator.requestMIDIAccess({sysex: true}).then(
  () => console.log("MIDI Started"),
  () => console.log("MIDI Failed"),
);

// express
const app = express();
app.post('/test', (req, res) => {
  res.json({ success: `Yeah!` });
});
app.use(express.json());
app.listen(3001, () => console.log("Express Listening..."));

After 2 hours, memory usage went from 19MB to 40MB. Is it possible that there is a memory leak in jzz ?

@jazz-soft
Copy link
Owner

Thank you for reporting that!
If the problem is Mac-specific, it should be in the jazz-midi module: https://github.com/jazz-soft/jazz-midi
The related code is in the midi subdirectory.
I'll try to investigate. You can also take a look with fresh eyes.

Just wonder why MIDI is used on the server side??
There can be some workarounds unless the server actually needs to connect to the MIDI devices.

@djipco
Copy link
Author

djipco commented Sep 17, 2024

Just wonder why MIDI is used on the server side??

I believe he uses express locally only.

However, I could totally see a scenario where local devices could be accessed remotely. For instance, you could create an interactive installation where remote users can trigger sounds in a museum space.

@djipco
Copy link
Author

djipco commented Sep 17, 2024

If the problem is Mac-specific, it should be in the jazz-midi module: https://github.com/jazz-soft/jazz-midi

I have only tested it on Mac but I don't know if the problem is Mac-specific.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants