Yes, this is something you can do in Java. The Sun JVM hprof format (and similar formats for other JVMs) is not exactly human-readable but there are quite a number of tools capable of reading and analysing such dumps. The point is that the data is structured in a format amenable to analysis.

I realise that libraries and XS code may be responsible but somehow I suspect that this is less likely in my case.