Bug 1252 : JAVA2D has a memory leak with MODEL manipulated text
Last modified: 2010-03-11 16:15




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P3
Severity:
normal

 

Reporter:
accadm
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2009-05-26 15:56
I've been experiencing a bug with JAVA2D. I'm trying to draw text around
the screen at different scales and orientations. When I use matrix
operations (translate, rotate, scale), I encounter a sizable memory leak.
This doesn't occur with the other renderers, but they have other drawbacks
so I can't use them. Here's a basic program which demonstrates the error:

PFont font;
int index = 0;

void setup () {
size (200, 200, JAVA2D);
font = createFont("Courier", 40);
textFont(font);
}

void draw () {
background(200);
pushMatrix();
translate(100, 100);
scale(1);
rotate((float)index/100.);
translate(-3, 3);
fill(100);
text((char)('A' + index%26), 0, 0);
popMatrix();
index++;
}

I'm using Processing 1.0.3. Any word on this leak would be appreciated.
Thanks.
Additional Comment #1 From fry 2009-05-26 15:59
Is this on all platforms, or are you on Mac OS X?
Additional Comment #2 From accadm 2009-05-26 16:02
Sorry, my main platform is Windows XP, but it has also been demonstrated on
OS X.
Additional Comment #3 From fry 2009-05-26 19:45
I ran into this the other day while working on a project. The error occurs
a ways into some Java code that deals with glyph caching for fonts. I think
this is something that may have changed in more recent Java releases, that
the glyph cache is getting overrun because of several fractional sizes for
the fonts. However, it may only be a coincidence that it's appearing now,
and might be a bug in Processing itself. I'll look into it further and see
what I can track down.
Additional Comment #4 From fry 2010-03-11 15:52
i can no longer get this code to crash, so i think the problem has been
fixed along the way, either in processing or in more recent java releases.