Thanks,
I was looking at the page allocator but it does not seems like the memory for isolate is allocated from it. Is it true or did I miss something?
In general I do not want to fail the allocation but only to know how much was allocated so I can take actions when the memory usage become to much (for example, I can try stop the JS code using terminate TerminateExecution). Currently I investigate 3 options:
1. Start each isolate with small memory limit and increase it in small junks when I get the near OOM callback. It works pretty nice, the only issue I saw is when the required memory is larger than the chunk that I use to increase the limit, V8 will still abort the processes, its not always the case but I did see it happened in certain cases. My question: does it make sense to provide the amount of memory required by the isolate to the near OOM callback, so I will know how much I need to increase the limit so that the V8 will not abort?
2. Avoid setting memory limit and just periodically check the usage and take actions if the usage is to high, but this can be very inaccurate.
3. I saw there is an API for third_party_heap that I can maybe implement and track the total memory usage, maybe this is a good direction to investigate.
Personaly I would prefer option 1, I already saw that it works nicely and I just need to know how much the limit should be increased to avoid V8 abort. Wonder what you think, maybe there are other options I did not considered?
Thanks a lot for the help and sorry it took time to reply.
Meir.