Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-26-2008, 03:12 PM
Member
 
Join Date: Jul 2008
Posts: 2
Rep Power: 0
KKDoWniNg84 is on a distinguished road
Default SWT Images via socket
Hello everyone, i'am new in the forum then i say hello to everyone. Excuse me but i'm italian and i know less english, i hope that you understand my problem. I have written a java program written with a GUI SWT. This program receive JPEG images via socket then i have received and draw these images in this way:

JPEGDecoder decoder = JPEGCodec.createJPEGDecoder(in);

BufferedImage img = decoder.decodeAsBufferedImage();

Image image = new Image(Display.getCurrent(), converter.convertToSWT(img));
pencil.drawImage(image, 0, 0);

All this code run in a loop For( ; ; ) and it work fine but there is a problem, every time that it receive an image via socket it make the instruction new Image... and this increments the memory used. I have tried in all ways and i don't found nothing that help me. Do you know a solution for my problem? There is another way to generate an Image (without "new") or there is another JPEGDecoder that generates an Image SWT??
Please answers me because i need an help!!!

Thanks in advance and Bye to everyone!!!
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 07-26-2008, 04:35 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,225
Rep Power: 4
Norm is on a distinguished road
Default
Do you only want to keep the last image read and to get rid of the ones that were read earlier?
Would the flush() method on old images get rid of the memory being used?
Sometime garbage collection should retrieve the storage used by the objects if they are no longer referenced.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-26-2008, 04:39 PM
Member
 
Join Date: Jul 2008
Posts: 2
Rep Power: 0
KKDoWniNg84 is on a distinguished road
Default
Originally Posted by Norm View Post
Do you only want to keep the last image read and to get rid of the ones that were read earlier?
Would the flush() method on old images get rid of the memory being used?
Sometime garbage collection should retrieve the storage used by the objects if they are no longer referenced.
Excuse me Norm i haven't understand well yours questions. But what i want is create a new Image without using "new" operator but simply modifying the first image with some methods as "image.set..." . Understand?
Thanks for your answers...Bye!
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket vortex New To Java 2 05-25-2008 06:41 AM
Socket Closed! rameshraj Networking 0 05-06-2008 11:48 AM
Socket Closed! rameshraj Networking 0 05-06-2008 10:11 AM
How To Make Socket Connection madhumurundi Networking 5 04-21-2008 06:05 PM
XML through a socket Heather XML 2 07-04-2007 09:31 AM


All times are GMT +2. The time now is 06:29 PM.



VBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org