Bug 832067 - Discard cached statements in healthreporter. r=gps

This commit is contained in:
Richard Newman 2013-01-25 00:39:01 -08:00
Родитель 6ae127581e
Коммит 5b8a3228cd
2 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -307,6 +307,9 @@ HealthReporter.prototype = Object.freeze({
this._log.info("HealthReporter started.");
this._initialized = true;
Services.obs.addObserver(this, "idle-daily", false);
// Clean up caches and reduce memory usage.
this._storage.compact();
this._initializedDeferred.resolve(this);
},
@ -695,6 +698,7 @@ HealthReporter.prototype = Object.freeze({
o.errors = errors;
}
this._storage.compact();
throw new Task.Result(JSON.stringify(o));
},

Просмотреть файл

@ -1204,6 +1204,21 @@ MetricsStorageSqliteBackend.prototype = Object.freeze({
});
},
/**
* Reduce memory usage as much as possible.
*
* This returns a promise that will be resolved on completion.
*
* @return Promise<>
*/
compact: function () {
let self = this;
return this.enqueueOperation(function doCompact() {
self._connection.discardCachedStatements();
return self._connection.shrinkMemory();
});
},
/**
* Ensure a field ID matches a specified type.
*