Re: Why is this code not cleaning up int arrays? or How to detect an image is a solid color?
- From: jw <joewetzel@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 08:16:23 -0700 (PDT)
Thanks for the suggestion RGB, but I know because of the images I'm
working with there are only about 7-8 possible solid color images.
Anyway, I first tried moved the declaration of the int array up,
hoping that would force the system to reuse teh same memory area each
time through the loop, but that didn't make a difference.
Then I made two other changes, and I'm not sure which was the actual
fix. I explicitly called System.gc() every 100th time through the
loop. Secondly I made a more fundamental change to the algorithm. I
switched from getting the BufferedImage's int array to repeatedly
using the BufferedImage's getRGB(x,y) method to get a single pixel of
info. When I wrote this before, I don't know if that method couldn't
be used for some reason (different image type for example) or if I
thought accessing the int array would be faster, or I just didn't know
about the method. Anyway, I didn't test these separately, so I don't
know which one made a difference, but I did want to post a follow up
for anyone interested or for future reference.
.
- Follow-Ups:
- References:
- Prev by Date: Re: Student Project Idea
- Next by Date: Re: Why is this code not cleaning up int arrays? or How to detect an image is a solid color?
- Previous by thread: Re: Why is this code not cleaning up int arrays? or How to detect an image is a solid color?
- Next by thread: Re: Why is this code not cleaning up int arrays? or How to detect an image is a solid color?
- Index(es):
Relevant Pages
|