java byte array memory not released -
As long as I have set the indicator to zero, why does memory usage increase every time I press the button? (Code Attach)
This continues my program memory usage continues
thanks. continue setting its variable to It is entirely possible that the memory never will continue, even then the garbage collector has run several times. Update I think I understand why your worries are coming from time to time for release of memory. In Java, memory is allocated on stack whether you know it or not, Java is configured with maximum heap size (you can specify this maximum on the command line). Suppose Java is running with the size of the maximum pile of 100 MB. Now, suppose the reason for allocation in your program is 5 MB. The operating system uses Java (approximately 5 MB) because all Java has requested the operating system at that time. As your program runs, the maximum memory will be continued to reach the maximum heap size (100 MB) at that time, at that time most of the garbage collectors will be more aggressive in their memory release. Until then, many garbage collectors can not easily bother leaving the memory. Therefore, you do not need to worry about the maximum memory from your operating system. package newHashFunction; Import java.awt.event.ActionEvent; Import java.awt.event.ActionListener; Import javax.swing.JButton; Import javax.swing.JFrame; Public Category Memory_not_released JFrame Expands {/ ** * @param args * / public static void main (string [] args) {// TODO auto generated method stub Memory_not_released memory_not_released = new Memory_not_released (); } Memory_not_released () {button button 1 = new pocket ("make byte"); Button1.addActionListener (New Exhibitist) {@ Override Public Voice ActionPerfect (Action Event E) {// Todo Auto-Generated Method Stub Byte [] Byte 1 = New Byte [10000000]; Byte 1 = Faucet;}}) ; (Button1) add; This.pack (); SetVisible (true); This.setDefaultCloseOperation (EXIT_ON_CLOSE); }} null Does not happen. Memory is issued only when the garbage collector decides that any other operation requires storage and should be recovered.
Comments
Post a Comment