Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

showing images & free them

Posted on 1999-06-30
9
Medium Priority
?
198 Views
Last Modified: 2011-09-20
I use a Timage component to show many pictures one by one. I use 'Timage.loadfromfile()' to load a picture,and I use it again when I need to show an other picture.but after I show some pictures,the Application abort.I think that's maybe because I'm not free the memory?? How can I free the memory? or there has any other reason?
0
Comment
Question by:strang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1385421
Please tell us more about how your application aborts. Some error messages?
And please give us some code as well. How does code "around" your LoadFromFile call look like?
0
 
LVL 15

Expert Comment

by:simonet
ID: 1385422
Are you creating any object on runtime?

Alex
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385423
I guess you mean Image.Picture.LoadFromFile.
Try the following before loading a new picture:

Image.Picture.Bitmap.FreeImage;
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Accepted Solution

by:
wipnav earned 100 total points
ID: 1385424
My answer is that the Image.Picture.LoadFromFile method works properly. You should be able to load as many different pictures as you like without the need to ever free the memory. I wrote a sample application in D3 that contained a loop. Within the loop I loaded two different .bmp images into a TImage component. I then used Memory Sleuth to monitor the application. After 1000 itterations there were no memory leaks, and no problems. My answer is that your problem must be something else that you are doing in your program.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385425
What about 100 diffent images of different sizes? I think the problem is memory fragmentation. With only 2 pictures that won't happen very quickly.
0
 

Author Comment

by:strang
ID: 1385426

the error message:
1.'stream write error'
2.'Access violation at adress xxxxxxxx.Write of adress  xxxxxxx'
3.'Canvas does not allow drawing'
the application showing one of these three message,then can't show any image at all.

in my program,I use TQrimage to load picture and use Tqrpreview to show them.I can show several pictures once and change page through setting Tqrreview.pagenumber .
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385427
Why are you using TQrimage and Tqrpreview? This puzzles me completely. These components are not quite bugfree.

Why not use TImageList.
TImageList.Add(...) to add Bitmaps
TImage.Picture.Assign(Bitmap) to show one of the pictures.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385428
Hmmm forget TImageList. It only accepts images with the same size. Using TList instead would be better.
0
 
LVL 1

Expert Comment

by:wipnav
ID: 1385429
I read the original question as a problem with the TImage component. I have never used TQrimage or Tqrpreview, and I don't think I want to.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question