Memory Leak in Node.js Program

I'm designing a daemon (specifically a worker process for Heroku) and the code I have slowly accumulates in ram usage. It's a small amount (100kb/10 seconds), but I know that for long-term use of this process, its best to keep the ram usage consistent. I am new to creating processes designed to run a long time and still pretty new to developing applications in Node and Javascript. Here is most of my code:

////////////////
// Queue Loop //
////////////////
var worker = (function() {
var buffer = "";
var couchdb = http.get({
    auth: db_user + ":" + db_pass,
    host: db_host, 
    path: '/queue/_all_docs?include_docs=true',
    port: db_port
}, function( response ) {
    response.setEncoding('utf8');

    response.on("data", function( data ) {
        buffer += data;
    });

    response.on("end", function() {         
        var queue = JSON.parse(buffer);

        if ( !queue.error ) {

            buffer = "";
            couchdb = http.get({
                auth: db_user + ":" + db_pass,
                host: db_host,
                path: '/flights/_all_docs?include_docs=true',
                port: db_port
            }, function( response ) {
                response.setEncoding('utf8');

                response.on("data", function(data) {
                    buffer += data;
                });

                response.on("end", function() {
                    var flights = JSON.parse(buffer);

                    if ( !flights.error ) {
                        for ( row in queue.rows ) {
                            console.log(queue.rows[row].doc.flight);
                        }

            for ( row in flights.rows ) {
                console.log(flights.rows[row].doc.program);
                }

                setTimeout( worker, 10000 );    
            } else {
                // db error
            }
            });
        }).on("error", function() {
            setTimeout( worker, 10000 );    
        });
            } else {
                // db error
            }
        });
    }).on("error", function() {
        console.error("CouchDB is currently not available.");
        setTimeout( worker, 10000 );
    });
});



///////////////
// Run Queue //
///////////////
(function() {
    worker();
})();

So with that, what is the best way to keep a program like this running constantly with the same amount of ram? What other design considerations are essential to keeping this running well enough to serve as a worker process on Heroku?

Oh and as for what it does, it pulls some entries out of a CouchDB instance and then it runs a prediction based on those entries.

It turns out that Node.js offers a nice function called process.nextTick() that clears the call stack (edit: this may not be the case, but it helps things from accumulating). By wrapping all of my calls to worker in it, I could prevent a theoretical stack overflow (which was not happening, but my memory usage was continuously growing).

My understanding of this function is not very deep, but it does what I have been wanting to do.

(edit: Turns out node has FANTASTIC garbage collection via V8, it runs at strange intervals though!)

Reads: