Hi,
Is there any way to delete data from app.data and have the allocated memory released? The docs say app.data is not grabage collected and we ran into a situation where (after running for a couple of days) the server's Java heap ran out of space. We suspect our way of using app.data could be leaking memory.
The following pseudocode demonstrates roughly how we are using app.data. The idea is to store some data in app.data that may or may not be requested by the user later. The stored entries are time-stamped and we try to purge entries that are older than a certain limit:
1. HTTP request arrives
...
app.data.cache = []; // initialize cache
var data = <some data>; // data we want to access later
var key = generateUniqueKey();
app.data.cache[key] = data;
for (key in app.data.cache) { // this loop is supposed to purge expired items
if (isExpired(app.data.cache[key])) {
delete app.data.cache[key];
}
}
...
2. HTTP response is sent with key
3. Client wants to access stored data
4. HTTP request with previously given key as a parameter arrives
...
var returnData = app.data.cache[key];
...
5. HTTP response with previously returned data is sent
Thanks!