question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Creating multiple waveforms and memory leaking

See original GitHub issue

Hi, I have a question

I am creating multiple waveforms and it works well by creating one instance and using MediaElement (thanks for people who helped it out #1005)

But I found that there’s memory leaking

Got this from Chrome Timeline and apparently it happens when it calls XHRhttpRequest image

And this from Chrome profile image

here’s the code from wavesurfer.js

 ajax: function (options) {
        ...
        var xhr = new XMLHttpRequest();
        xhr.open(options.method || 'GET', options.url, true);
        xhr.responseType = options.responseType || 'json';
        ...
    }

what I don’t understand is this ajax function calls an audio file (ex. http://localhost/audio/sample.mp3) and my understanding of ajax call is usually some code file.

So my question is

  1. why ajax function calls an audio file.
  2. the way how to prevent memory leaking or to free used memory

Browser version(s):

Chrome Version 56.0.2924.87 (64-bit)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mspaecommented, Mar 6, 2017
  1. Ajax (aka XMLHttpRequest) can be used to fetch all kinds of files. Wavesurfer loads audio with Ajax if 1. Backend Web Audio is used or 2. Peaks are not provided
  2. There are several memory leaks which are currently being fixed for version 2 - the one you experience is probably due to this.arraybuffer not being nullified in destroy.
0reactions
rejochandrancommented, Jun 13, 2020

Hi @DOOGIE-CHOE ,

Thanks for the note and I tried this and still got this issue. Some of my findings,

  1. The issue mostly occurs in Chrome as it does not clear the memory when a wavesurfer instance is destroyed and opening another instance just adds with to the existing memory and hence mounts up
  2. The issue seems to be only with WebAudio as backend but I have no other choice as my application requires the user to navigate back and forth to analyze the audio.

Most of the issues are part of #1940 , So hopefully we get this resolved 🙂 and thanks again for your quick response

Read more comments on GitHub >

github_iconTop Results From Across the Web

Huge memory leak related to Waveform Chart - NI Community
Everything got better but memory still keeps rising to 1500 MB. It seems to be caused by the Waveform Graph property nodes or...
Read more >
Memory leak from waveform plotting at high frequency
The problem is that you are using 'f' as a loop index. That won't work here, because it starts the array at 200000000,...
Read more >
Memory leak using multiple boost::connect on single slot_type
I'm using boost::signals and leaking memory when I try to connect multiple signals to a single slot_type . I've seen this same leak...
Read more >
Memory leak in C++ and How to avoid it? - GeeksforGeeks
Memory leakage occurs in C++ when programmers allocates memory by using new keyword and forgets to deallocate the memory by using delete() ...
Read more >
M1 Mac Waveforms Memory leak beachball - Digilent Forum
No variation of settings on scope trace run escapes this memory leak. The memory leak is only solved by quit/restart of waveforms.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found