apache / apache/cordova-ios

XMLHttpRequest memory leak

Open
#1,311 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
1k
Avg merge
12h 11m
Merged PRs (30d)
18

Description

# Bug Report

## Problem
After switch from version 4.5.5 to 6.2.0 there is a problem with XMLHttpRequest. In my app i'm downloading many files from server that are saved on device.

When i'm call this method many times likes ~400 (depends on device) on ~1MB file, the application crashes (before crash there is a warning about memory leak in Console app on Mac).

```
function load() {
this._loader = new XMLHttpRequest();
this._loader.open("GET", path, true);
this._loader.onload = () => {
if (this._loader.status != 200) {
return;
}
load();
};
this._loader.responseType = "arraybuffer";
this._loader.send();
}
```
This method just downloading file and does nothing with it (GC should just clean this).

This issue is similar to this one: https://github.com/apache/cordova-ios/issues/522

In version 4.5.5 all works fine, without any problem.

### Environment, Platform, Device
iOS 15.7.3 (iPad mini 4)
iOS (iphone 11)

### Version information
cordova-cli 11.1.0
cordova-ios 6.2.0

## Checklist
- [x ] I searched for existing GitHub issues
- [x ] I updated all Cordova tooling to most recent version
- [x ] I included all the necessary information above

Contributor guide

Open the contributing guide

Research direction

No source file or failing test is named. Start by reproducing repeated XMLHttpRequest downloads with the supplied function on the listed iOS devices, then compare cordova-ios 4.5.5 with 6.2.0. Done means identifying whether the memory growth is a cordova-ios regression and documenting a verified fix or clear reproduction details.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, javascript
Domain
mobile-dev, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.