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. On Thursday, 11 May 2023 at 03:37:40 UTC+3 [email protected] wrote: > On Tue, May 9, 2023 at 3:05 PM Meir Shpilraien <[email protected]> wrote: > > > > I know I can limit the memory used by a single isolate. But assuming my > application creates more than one isolate. Is there a way to put a global > limit such that the memory used by all isolates combined will not bypass > this limit? > > V8 has no such mechanism built in. > > Users of V8 have cobbled together various solutions but they > ultimately all involve tracking isolates and forcing garbage > collection (isolate->LowMemoryNotification()) or terminating them when > they exceed a threshold. > > If crashing is okay for your use case, implementing your own > PageAllocator could work; see include/v8-platform.h. > Disclaimer The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful. This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business. Providing a safer and more useful place for your human generated data. Specializing in; Security, archiving and compliance. To find out more visit the Mimecast website. -- -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev --- You received this message because you are subscribed to the Google Groups "v8-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/1b9d411e-06e2-45af-9c1c-4d911e0c3e20n%40googlegroups.com.
