8

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;
1
  • 2
    You don't even need to do that. Just let the variable fall out of scope and it will automatically be garbage collected. Commented Jan 19, 2018 at 14:54

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.