Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-26-2008, 04:12 PM
Member
 
Join Date: Jul 2008
Posts: 2
KKDoWniNg84 is on a distinguished road
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
Sponsored Links
  #2 (permalink)  
Old 07-26-2008, 05:35 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SW MO, USA
Posts: 1,475
Norm is on a distinguished road
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, 05:39 PM
Member
 
Join Date: Jul 2008
Posts: 2
KKDoWniNg84 is on a distinguished road
Quote:
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
Sponsored Links
Reply


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

vB 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 07:41 AM
Socket Closed! rameshraj Networking 0 05-06-2008 12:48 PM
Socket Closed! rameshraj Networking 0 05-06-2008 11:11 AM
How To Make Socket Connection madhumurundi Networking 5 04-21-2008 07:05 PM
XML through a socket Heather XML 2 07-04-2007 10:31 AM


All times are GMT +3. The time now is 07:10 AM.


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