On 20 October 2011 01:46, Andrew Cowie <and...@operationaldynamics.com> wrote:
> On Wed, 2011-10-19 at 18:01 +0100, William Temperley wrote:
>>  I wonder if anyone has a
>> quick and dirty workaround for freeing up this memory? I'm doing a
>> production run of approximately 6000 maps for a website, which grinds
>> to a halt after 100 or so maps, using all 8GB of RAM.
>
> Eek. That's no good.
>

I've had to resort to scripting the app with Python to do batches -
ugly but works!

>
> The problem, I think is:
>
> a) that GLib allocated memory is outside the visibility of the JVM
>
>  cross product
>
> b) the JVM garbage collector only runs when *it* thinks that it is out
> of memory.
>
> This second point is somewhat counter to expectation, but of late I've
> noticed that Java doesn't "waste" time with full GC (let alone actual
> page release back to host OS) until it thinks it is a last resort.

I've found that Linux has been killing my large process when all
memory and virtual memory has gone. I guess this could be due to
either the JVM not knowing the proxy objects are huge and should be
cleaned up, or the memory has been leaked by the proxies.

> Anyway, the side effect of (a) × (b) is that our GObjects don't get
> free'd until Java processes the Proxy object being out of scope and they
> are finalized; that doesn't happen until the GC has done its thing. The
> objects *will* get freed, but when is open to question.
>
> So as an immediate debug, I would ask what the effect of sticking a
> System.gc() in right after your Pixbuf goes out of scope. I know we've
> all been trained out of making that call over the years, but it might be
> worth offering the hint.

I've just tried that and I'm still seeing the same memory increases
unfortunately.  This didn't work in

>
> If that doesn't work, we'll look deeper. If it does work, we'll look
> deeper.
>

I'm fairly sure it's Pixbuf that's causing this. For a bit of
background, I do a lot of drawing hefty polygons onto Cairo canvases
and draw images using the Pixbuf.  When isolating the leak by
commenting out code (having had no luck with profilers as they don't
see the allocated native memory) I ran the app with Pixbufs being
constructed but not used and got massive memory use. Commenting out
the construction of the Pixbuf - i.e. just one line - lead to steady
memory usage.

OTOH, The good news is I've been doing some fairly hefty work creating
and destroying hundreds of Cairo canvases and drawing massive polygons
on them (some with over 60,000 vertices) and I've not seen leaks with
these.

Will

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
java-gnome-developer mailing list
java-gnome-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/java-gnome-developer

Reply via email to