Memory leak before crash due to HttpRequest

I played with HttpRequest and realized that the memory is not cleared after any request. After a while, the working tab in Chrome will launch.

Here are some test codes. Put the large file in the "web" directory and set the URL in the code accordingly.

import 'dart:async';
import 'dart:html';

void main() {
  const PATH = "http://127.0.0.1:3030/PATH_TO_FILE";
  new Timer.periodic(new Duration(seconds:10), (Timer it)=>getString(PATH));
}

void getString( String url){
  HttpRequest.getString(url).then((String data){
  });
}

Just rechecked, a memory leak still exists:

  • Current Version: 24275
  • Duration Used: 30 Seconds
  • Used file: chromium \ chrome.dll.pdb copied to the web directory of the current project
  • Tried under Windows 64bit as well as Linux 64bit

A memory leak exists only in Dartium. When I compile the code in JS and run it in Firefox, the memory usage increases to 3.5 GB and stays there.

Is this really a mistake, or am I something wrong?

+3
2

, HttpRequest; - Dart. , , , .

0

, .
, , 15 ( ).

. https://code.google.com/p/dart/issues/detail?id=20833 .

import 'dart:io';

void main(List<String> args) {
  HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 9090).then((server) {
    server.listen((HttpRequest request) {
      var client = new HttpClient();
      client.getUrl(Uri.parse("https://www.google.com")
          .then((req) => req.close())
          .then((resp) => resp.drain())
          .whenComplete(() {
            client.close();
            request.response.close();
          });
    });
  });
}

, , HttpClient, , .

import 'dart:io';

void main(List<String> args) {
  HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 9090).then((server) {
    server.listen((HttpRequest request) {
      var client = new HttpClient();
      client.getUrl(Uri.parse("https://www.google.com")
          .then((req) => req.close())
          .then((resp) => resp.drain())
          .whenComplete(() => request.response.close());
    });
  });
}
0

All Articles