sanjihan
sanjihan

Reputation: 6014

freeing up memory of Buffer instance in Node.js

node comes with abundance of method to create Buffers, but I haven't found one that dealocated the allocated piece of memory.

Do I just set buffer to null when I am done using it and let garbage collection kick in?

var buffer = new Buffer("pls dont null me");
buffer = null;

Upvotes: 7

Views: 3898

Answers (1)

Fernando Paz
Fernando Paz

Reputation: 623

You should not care about it. When you stop using the variable, the garbage collector will collect. Just in case, its ok if you want to set null.

See the buffer documentation in the Node.js site.

Upvotes: 7

Related Questions