An application I'm working on embeds V8 for scripting. To conserve memory, I want to shut down the scripting component when it is not needed, but for some reason the memory is never returned to the OS.
Here's what I tried:
1. Call Dispose() on the persistent context handle
context.Dispose();
2. Force a garbage collection
while (!v8::V8::IdleNotification());
None of that has any notable effect on the processes memory usage. I can clearly see how it's going up when a script claims memory, but it never goes down again.
I'm determining process memory usage with ps -o rss
. I know that figuring out how much memory a process is using is not really possible without a profiler, but I do believe rss should go down when V8 lets go of the memory.