11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 8020983 8024697
27 * @summary Test verifies that jpeg writer instances are collected
28 * even if destroy() or reset() methods is not invoked.
29 *
30 * @run main JpegWriterLeakTest
31 */
32
33 import java.awt.Color;
34 import java.awt.Graphics2D;
35 import java.awt.image.BufferedImage;
36 import java.io.ByteArrayOutputStream;
37 import java.io.IOException;
38 import java.lang.ref.Reference;
39 import java.lang.ref.ReferenceQueue;
40 import java.lang.ref.WeakReference;
41 import java.util.ArrayList;
42 import java.util.Random;
43 import javax.imageio.ImageIO;
44 import javax.imageio.ImageWriter;
45 import javax.imageio.stream.ImageOutputStream;
46
47 public class JpegWriterLeakTest {
48
49 public static void main(String[] args) {
50 final ReferenceQueue<ImageWriter> queue = new ReferenceQueue<>();
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /**
25 * @test
26 * @bug 8020983 8024697
27 * @summary Test verifies that jpeg writer instances are collected
28 * even if destroy() or reset() methods is not invoked.
29 *
30 * @run main JpegWriterLeakTest
31 * @key randomness
32 */
33
34 import java.awt.Color;
35 import java.awt.Graphics2D;
36 import java.awt.image.BufferedImage;
37 import java.io.ByteArrayOutputStream;
38 import java.io.IOException;
39 import java.lang.ref.Reference;
40 import java.lang.ref.ReferenceQueue;
41 import java.lang.ref.WeakReference;
42 import java.util.ArrayList;
43 import java.util.Random;
44 import javax.imageio.ImageIO;
45 import javax.imageio.ImageWriter;
46 import javax.imageio.stream.ImageOutputStream;
47
48 public class JpegWriterLeakTest {
49
50 public static void main(String[] args) {
51 final ReferenceQueue<ImageWriter> queue = new ReferenceQueue<>();
|