There is no standard system in Java for truly isolating the memory used by web applications.
However, you can write some byte encoding of the byte code to keep track of how much memory is allocated by a particular application. If it crosses a certain threshold, you can throw an exception and stop the application from allocating more memory. What do you want to do if you can track all the memory consumed by the web application? What are you trying to implement?
Please note that this will only work effectively to find out how much memory is allocated to the web folder, and not how much it currently consumes on the system. To get this metric, you will need the bytecode weave finalize () for all objects. Since finalize () is launched using the JVM with maximum efficiency, this may not give you the most accurate value if the system is under load. The JVM will strip these finalized topics, and your value will never be updated, even if the objects have been cleared.
keian source share