B
B
BestJS2016-11-22 17:51:28
Node.js
BestJS, 2016-11-22 17:51:28

How to clean up memory without garbage collector in NodeJs?

I'm the author of this question Why doesn't DELETE work in NodeJs? it is directly related to this
Experiment Method, it came to this:
For example, creating a large string and then overwriting it:

a = new Array(10000000).join('lalalalalalalalalalalala'); // Назовем - "значением 1"
a = new Array(10000000).join('bebebebebebebebebe'); // Назовем - "значением 2"

In this case, the second line overwrites the value 1 with the value 2, BUT the value 1 is not removed from the memory
.
who cares:
1) delete - doesn't work at all, doesn't even delete the content from the variable (NodeJs)
2) if you assign null to the variable, then again, nothing will be deleted, the old data remains in the RAM until deleted.
I tried to explain clearly and in detail.
I would like that immediately after the removal, the RAM would be cleaned of the contents.
This is necessary so that the garbage collector does not spend extra time cleaning up memory.
How to deal with it? Maybe there is a module?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Виталий, 2016-11-22
@BestJS

Не может быть такого модуля, ибо вы пытаетесь идти против движка V8 - самой виртуальной машины, которой обрабатываются все нодовские скрипты. Если вам критична скорость освобождения памяти, советую обратить внимание на С++, например Tufão - асинхронный веб фреймворк на C++ с использованием Qt.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question