garbage-collection

Garbage collection runs too late - causes OutOfMemory exceptions

穿精又带淫゛_ 提交于 2019-12-22 08:46:16
问题 Was wondering if anyone could shed some light on this. I have an application which has a large memory footprint (& memory churn). There aren't any memory leaks and GCs tend to do a good job of freeing up resources. Occasionally, however, a GC does not happen 'on time', causing an out of memory exception. I was wondering if anyone could shed any light on this? I've used the REDGate profiler, which is very good - the application has a typical 'sawtooth' pattern - the OOMs happen at the top of

Memory Management for local objects in java

☆樱花仙子☆ 提交于 2019-12-22 08:35:37
问题 If I have a method inside a class and I am creating an object inside that method then would that object be destroyed and the memory allocated to it released once the method is finished? eg. - public void drawFigure(){ Paint paint = new Paint(); paint.setSomeProperty(); canvas.drawLine(startPoint, finishPoint, paint); } So after the method drawFigure is complete, paint object will be destroyed ? which same as paint = null, but I do not need it to be set to null, because it is a local object.

java full gc taking too long

☆樱花仙子☆ 提交于 2019-12-22 08:19:04
问题 I have a Java client which consumes a large amount of data from a server. If the client does not keep up with the data stream at a fast enough rate, the server disconnects the socket connection. My client gets disconnected a few times per day. I ran jconsole to see the memory usage, and the heap space graph looks like a fairly well defined sawtooth pattern, oscillating between about 0.5GB and 1.8GB (2GB of heap space is allocated). But every time I get disconnected is during a full GC (but

Python: is the garbage collector run before a MemoryError is raised?

有些话、适合烂在心里 提交于 2019-12-22 08:17:33
问题 In a Python code that iterates over a sequence of 30 problems involving memory- and CPU-intense numerical computations, I observe that the memory consumption of the Python process grows by ~800MB with the beginning of each of the 30 iterations and finally raises an MemoryError in the 8th iteration (where the system's memory is in fact exhausted). However, if I import gc and let gc.collect() run after each iteration, then the memory consumption remains constant at ~2.5GB and the Python code

Garbage collector test

我与影子孤独终老i 提交于 2019-12-22 08:15:51
问题 I have written a simple .net forms application to test some behaviour of .NET about how it handles memory together with the garbage collector to do the cleaning. The forms application GUI looks like this: And the code behind like this: public partial class Form1 : Form { private readonly IList<byte[]> _btyList = new List<byte[]>(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int i = 0; while (i < 3) { byte[] buffer = File.ReadAllBytes(@"C

Garbage collector test

久未见 提交于 2019-12-22 08:15:05
问题 I have written a simple .net forms application to test some behaviour of .NET about how it handles memory together with the garbage collector to do the cleaning. The forms application GUI looks like this: And the code behind like this: public partial class Form1 : Form { private readonly IList<byte[]> _btyList = new List<byte[]>(); public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { int i = 0; while (i < 3) { byte[] buffer = File.ReadAllBytes(@"C

Impossible Java memory references in Heap Dump

前提是你 提交于 2019-12-22 08:07:15
问题 I have a Java Heap Dump taken at 7:41pm which I am analysing with Eclipse Memory Analysis Tool. The heap dump includes 20 session objects. Using the Path to GC Roots command on one of these session objects in my heap shows the following 3 references to the session object. A finalizer reference from the "unfinalized" linked list owned by the Finalizer thread. My object is 3rd in line to be finalized. A strong reference to the session object from a message handler thread which is itself

C# Garbage collection

拥有回忆 提交于 2019-12-22 08:06:09
问题 say we have: public void foo() { someRefType test = new someRefType (); test = new someRefType (); } What does the garbage collector do with the first heap object? Is it immediately garbage collected before the new assignment? What is the general mechanism? Thanks, Juergen 回答1: What does the garbage collector do with the first heap object? Who knows? It's not deterministic. Think of it like this: on a system with infinite memory, the garbage collector doesn't have to do anything . And you

Why do I need to call a close() or shutdown() method?

假如想象 提交于 2019-12-22 07:28:27
问题 I'm new in Java with some background in C++ in my High School years. Now I'm trying to make something and I chose Java as the programming language. I've done my homework and look a lot about "destructors" for Java, finalize() method, and close() or shutdown() methods. But still I think I don't have the idea of how this should work (more info below of course) OK, the concrete question would be why do I need to call close() or shutdown() methods? In my particular case I'm working with a class

Why do I need to call a close() or shutdown() method?

拜拜、爱过 提交于 2019-12-22 07:28:06
问题 I'm new in Java with some background in C++ in my High School years. Now I'm trying to make something and I chose Java as the programming language. I've done my homework and look a lot about "destructors" for Java, finalize() method, and close() or shutdown() methods. But still I think I don't have the idea of how this should work (more info below of course) OK, the concrete question would be why do I need to call close() or shutdown() methods? In my particular case I'm working with a class