How to find the cause of a OutOfMemoryError in OH2?

If you go with Prometheus instead of Telegraph there is a binding that gives you all sorts of information about OH internals. See New Add-on bundle for Prometheus health Metrics