[node] Allow GC in spite of reference loops through the request method

The following produces a reference cycle:

var map = new mbgl.Map({
    request: function () { ... }
});

map has a reference to the request function, which has a reference to
its closure, which has a reference to map.

Storing a the map options in an internal field, rather than a Persistent,
allows V8 to collect the reference cycle when none of its members have
other references.
This commit is contained in:
John Firebaugh
2015-11-20 16:09:58 -08:00
parent 8a0bce7808
commit c4c3a19d85
6 changed files with 35 additions and 73 deletions

View File

@@ -1,5 +1,4 @@
#include "node_request.hpp"
#include "node_file_source.hpp"
#include <mbgl/storage/response.hpp>
#include <cmath>