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-management
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
Object lifecycle and GC in case of Composition
Below is an example of Composition: What I learned is that as soon as object of A3 is GC’ed (or becomes eligible for GC), object of B will also be GC’ed (or becomes eligible for GC). Now, let’s consider below situation, so as per my understanding after d.m1();, a3 object on heap will become eligible for GC, but I don’t
Using pmap and gdb to find native memory leak
I am debugging a native memory leak in java application. The rss is growing 1GB/day while heap showing no increase. On comparing the output of pmap over time, I see multiple anon blocks getting added either at the top of heap or between two native libraries. Can I say the memory increase between, say sssd_pac_plugin.so and librmi.so, is due to
What does push into stack means? move or duplicate method?
When an object calls a function, the function would be pushed from the method area into the stack. My question is: Q: What does that “push” mean in this context? Does that simply mean move(from the method area) or copy of the function(a copy of the method pushed onto the stack)? Answer The method itself is not pushed onto the
Would writing a server in 64bit Java be stunted by JVM heapsize / memory?
It looks like 32 bit java program can only use between 1-2 gigs of ram? http://publib.boulder.ibm.com/infocenter/javasdk/tools/index.jsp?topic=%2Fcom.ibm.java.doc.igaa%2F_1vg00014884d287-11c3fb28dae-7ff6_1001.html Could I expect a java program running in 64bit OS to not have this limitation? Answer Could I expect a java program running in 64bit OS to not have this limitation? Yes, it should be fine. However, it makes sense to check on the
Android Resources Class Memory Usage
I’m making modifications to the Android 4.0 launcher and I have been running into many OutOfMemoryErrors. Since the 4.0.3 update it got much worse (or started, it seems before it was fine, but I never got to test properly) and I have tried many many things to fix it. The error is also in the stock launcher without my modifications.
How to calculate HashMap memory usage in Java?
I was asked in an interview to calculate the memory usage for HashMap and how much estimated memory it will consume if you have 2 million items in it. For example: The mapping is like this. How would I estimate the memory usage of this HashMap Object in Java? Answer The short answer To find out how large an object
Is Java’s Swing really a “memory hog”?
I frequently hear that Java’s Swing toolkit is considered a “memory hog” (such as this answer). Is this… A due to Swing’s architecture; B inherent in Java’s memory management; or C an unfounded claim that stems from a lack of understanding how memory allocation works (e.g. just because the Task Manager says an application has allocated x MB, it does
Increasing JRE Memory Usage in Eclipse
I read in another question that you can increase the JRE memory allowance for an app through Window -> Preferences in Eclipse, but I can’t seem to find anything related to heap memory allocation. Editing -xms/xmx values in eclipse.ini doesn’t help since those are for Eclipse itself. Answer I believe when Run > Debug Configuration (or Run Configuration), then Arguments