4
votes

I'm debugging a Javascript application using too much memory. In Heap Profiler, it says there's about 300MB, but according to Chrome's Task Manager, it uses about 950MB in total, with 40MB of "Javascript Memory."

It seems like the 650MB difference between Task Manager and Heap Profiler is due to native memory, based on this question:

Chrome Heap Snapshot - Why it doesn't show all the memory allocated?

However, I can't figure out what "native memory" is, and googling hasn't been helpful. What types of things go into native memory, and how would I go about debugging what is using so much native memory?

Possible duplicates (all unanswered):

Heap profiler's reports vs task manager's reports: who to believe?

Huge difference between memory usage displayed in chrome's task manager and memory timeline

1

1 Answers

0
votes

I won't give my hand for this, but I assume that native memory is the whole memory slice chrome reserves for the javascript task. That's why it is shown in the task manager. The heap memory, on the other hand, contains all objects that are allocated by the javascript task. When such an object has no references anymore it might be dropped from the heap, by the garbage collector. If your javascript task gathers more and more heap you might have leaks in your code. The heap profiler can support you in finding such memory leaks but in general, take care to clean the references to all of your objects, when writing any code.