title: How can I clear a string from a Java program's memory?
body: <p>I'm trying to learn JVM attaching. I've learned how to attach the agent to the JVM, and it all works fine. My question is, is it possible to remove the string from the target's memory after attaching? If you search for the .jar using Process Hacker 2, you can find its path in the memory. Example:
  <a href="https://i.stack.imgur.com/ou0dh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ou0dh.png" alt="In this screenshot there are alot of strings left in the memory"></a></p>
  
  <p>I've seen programs doing similar things, like LSquad (which is a program for clearing Minecraft hacks' strings). I tried decompiling it using Luyten, and I saw it uses an external DLL. Can you do it in native java, or there is an external library required?</p>