I have a GUI desktop application which generates different types of hash (example MD5) for files and directories. Recently, when I was testing with a 1GB test file I recognized that it becomes slower and slower over time. At the first hashing, it takes about 2 seconds for a 1GB file, however later, for the exactly same file, it takes
Tag: memory
java Program runtime is too fast? Issue with Memory
So I am running some simulations that require some sample datasets. For the sake of simplicity I am using this http://loremipsum.sourceforge.net/ Lorem Ipsum generator. I am setting a test parameter called DATASIZE that sets the amount of words or paragraphs this generator creates. I am using this generated data to create an “input” and “output” hash. The output data will
Measure memory consumption with all HttpSessions in Tomcat at an arbitrary point in time
I want to measure the percentage of memory used by HttpSession in a web application. Is there any way to measure memory consumption with all HttpSessions in a running Tomcat instance at an arbitrary point in time without modifying the application? What I have tried In Tomcat, the concrete class of HttpSession is org.apache.catalina.session.StandardSession. I have profiled the application with
Does functions occupy more memory for each instance of the same object?
Imagine this extreme situation: A class City with 10 variables, but 1000 lines of functions and logic that operates these variables. I don’t know exactly how much memory will occupy a instance of this class, but let’s say that the variables occupy 10 bytes and the 1000 lines of functions occupy 1 kb to put a sample amount. If you
Conserving RAM in java by using references to objects
I know some about java, and a lot about the lower level functions of a computer, so I’m always looking for ways to conserve ram. I’m also a fan of dwarf fortress, so I’ve been trying to get some similar system working. So, what I want to do is to make multiple tiles, assign them some type of material, and
How can we simulate OutOfMemory: Metaspace?
I have a task to simulate OutOfMemory: Metaspace error intentionally. I tried different ways, but none gave me needed result. Can someone share good example for this purpose? My first attempt (using javassist): and settings in gradle.properties file: org.gradle.jvmargs=-XX:MaxMetaspaceSize=70M but I’ve got an error: Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread “main” which I couldn’t catch. My second attempt:
Do session objects take resources in my application? Won’t garbage collector remove them?
I came across part in Head First JSP and Servlets page:241 where it says that we have to get rid of sessions as shown in this picture: Later on they present methods invalidate() and …
In java, is there a way to examine how an object is still reachable from garbage collection root?
The codebase is somewhat complex, so I was wondering if there was a tool to examine an object at runtime and determine how the JVM still sees this object as reachable. In particular, there’s one object type that I would only expect to be one instance of at a time throughout the life of the app (new ones can be
java.lang.InternalError: a fault occurred in a recent unsafe memory access operation in compiled Java code
I was wondering if some of the JVM gurus out there can briefly explain the following error. What does it actually mean in technical terms and what are the sequences of events that can lead to this error? Answer This error means that sun.misc.Unsafe.getX() or putX() memory access resulted in SIGBUS error, which was then caught by JVM and translated
Java JNA – Base Address Finding
I am currently attempting to read/write to memory through the use of JNA for Java. For the past week I have tried a multitude of solutions, mostly from [similar projects][1] I have found online, but nothing has resolved my problem. I know I am receiving the correct process ID of the program, then I create a Pointer using the openProcess