Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
Creating blob and send it Ajax as form data object create memory leak

Hello i nead to send a blob to a server to specific folder. My problem is when i creating blob and send it Ajax as form data object it cause memory leak. How i can free memory after or before Ajax call and how to make this asynchronous... Please help

This is my code:

 button1.addEventListener('click', event =>{
            
            var dataURI = output.canvas.toDataURL();
            var byteString = atob(dataURI.split(',')[1]);
            var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
            var arrayBuffer = new ArrayBuffer(byteString.length);
            var _ia = new Uint8Array(arrayBuffer);
            for (var i = 0; i < byteString.length; i++) {
                _ia[i] = byteString.charCodeAt(i);
            }
            var dataView = new DataView(arrayBuffer);
            var blob = new Blob([dataView], { type: mimeString });
            console.log(blob);
        

            

    var formData = new FormData();  // create a new form data
            formData.append("image", blob, "image.png");

    // other form objects // 

        
        $.ajax({
        type: 'POST',
        url: '/app',
        data: formData,
        processData: false,
        contentType: false
        })
        
        .done(async function() {
       
        await sleep(10000);
        
        })
        
    

});

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!