Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

XMLHttpRequest memory leak #1311

Open
kiture opened this issue Apr 15, 2023 · 2 comments
Open

XMLHttpRequest memory leak #1311

kiture opened this issue Apr 15, 2023 · 2 comments

Comments

@kiture
Copy link

kiture commented Apr 15, 2023

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: #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
@breautek
Copy link
Contributor

Are you using any xhr plugins?

XMLHttpRequest is handled by the webview implementation unless if you have a cordova plugin that overwrites it, which was a common solution people used to avoid CORS. The core cordova platform does not override XMLHttpRequest.

So if you're using an XHR plugin, that is likely the source. Otherwise the issue is likely within WKWebView itself.

@kiture
Copy link
Author

kiture commented Apr 18, 2023

I'm tested both versions, with and without plugin and there was the same result.

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

No branches or pull requests

2 participants