getAllReachableObjects is somewhat easy to implement in C. I will try to pursue my own implementation.. and if we fail we have a failback on the jetbrains route.
there are some reporting things I'm doing to show where are eventual leaks. I worked on a test with Justin, and we asserted noObjects in the heap and it worked like a charm. I just need to find a way to deploy a maven repo somewhere. On Sat, Nov 5, 2022 at 11:13 AM Jiri Daněk <jda...@redhat.com> wrote: > > On Sat, Nov 5, 2022 at 4:00 PM Clebert Suconic <clebert.suco...@gmail.com> > wrote: > > > There are of course tools that would been written before. I have not > > seen anything that would be as simple as I'm proposing (with the > > exception of the .NET where you can get a list of objects). > > > > Yes! It is weird that C#, Python, JavaScript, all have a simple way to list > heap objects, only in Java it seems soo hard to do. > > > > What I'm doing is based on the JBoss Profiler that I wrote many years > > ago (and I left it rotten and dead)... so this would revive the simple > > parts just for the JUnit Tests. > > > > Yeah, I linked it in my previous mail. I was thinking that the code looks > somewhat similar, except it's in C and not C++... > > > > You just get a simple list of Objects before and later. > > > > > > Regarding the criticism to JMVTI.. I have it already written, besides > > any tooling around Java and Debugging will require C dev... > > > > > > the project itself already exists.. and I think it's viable. I am > > looking for options to host it, while you seem to be looking for > > counter arguments for having it done? > > > > I'm just writing up the results of my explorations. Initially I hoped to > learn what is possible. Best case would be I found something that's already > written and hosted, and that does not include native code (think all those > possible build/compatibility issues).... that did not really happen... > > Some tests can be written using the weakref approach, but that has limited > use for only specific scenarios. The dumping and reading of hprof file > might work, but I did not find a good Java implementation (Shark is in > Kotlin). The jetbrains JVMTI library looks reasonable, on a first sight, > though. > > > > if you give me an alternative in Java where i can do > > jvmti.getallObject(clazz); and eventually list the references for it.. > > perhaps I could just use that option instead. Such thing will be > > written in C anyways. > > > > https://github.com/JetBrains/debugger-memory-agent > > MemoryAgent ma = MemoryAgent.get(); > if (ma == null) { /* handle failure to load */ } > ma.getAllReachableObjects(null, clazz); > -- > Mit freundlichen Grüßen / Kind regards > Jiri Daněk -- Clebert Suconic