Good evening,
Working with C++ Ent. 10.4 on Windows 10 Pro.
Multidevice - Windows 32 bit.
I have a SQLite database that has a column of image names with Path and File Name.
I "SELECT" the image filename through a query.
file_name_d = Form_Display->FDQuery_Display->FieldByName("File_Name")->AsString; // File_Name has dir as well = D:\blah blah blah\file.jpg
The image is updated by
Image_P1->Bitmap->LoadFromFile(file_name_d);
Image_P1->Repaint();
I can cycle through, and put next image as Image_P1 ...
This works well, until It develops an out of memory error ...
Is there a way to clean / wipe any memory of the image before recycling it ?
Thank you.
Andrew
Image Update
Moderator: 2ffat
Re: Image Update
Code: Select all
Image1->Picture->Bitmap->FreeImage();
Image1->Picture->Bitmap = NULL;
-
- Active Poster
- Posts: 17
- Joined: Fri Nov 06, 2020 12:36 am
Re: Image Update
I will try tonight
Thank you
Thank you
-
- Active Poster
- Posts: 17
- Joined: Fri Nov 06, 2020 12:36 am
Re: Image Update
No, this didn't resolve.
Re: Image Update
That will only work in VCL, not in FMX. There is no Picture property in FMX's TImage, and FMX's TBitmap does not have a FreeImage() method (it does have a FreeHandle() method, though).Lena wrote: ↑Wed Nov 25, 2020 4:40 amCode: Select all
Image1->Picture->Bitmap->FreeImage(); Image1->Picture->Bitmap = NULL;
Remy Lebeau (TeamB)
Lebeau Software
Lebeau Software
Re: Image Update
Are you sure that is the real problem? I would consider it a major bug if LoadFromFile() did not perform all necessary cleanups before loading the new file.Andrew McIsaac wrote: ↑Tue Nov 24, 2020 1:45 am The image is updated by
Image_P1->Bitmap->LoadFromFile(file_name_d);
Image_P1->Repaint();
I can cycle through, and put next image as Image_P1 ...
This works well, until It develops an out of memory error ...
Is there a way to clean / wipe any memory of the image before recycling it ?
Does this exhibit the same problem?
Code: Select all
TBitmap *Bmp = new TBitmap(file_name_d);
try {
Image_P1->Bitmap = Bmp;
// or: Image_P1->Bitmap->Assign(Bmp);
}
__finally {
delete Bmp;
}
Image_P1->Repaint();
Remy Lebeau (TeamB)
Lebeau Software
Lebeau Software
-
- Active Poster
- Posts: 17
- Joined: Fri Nov 06, 2020 12:36 am
Re: Image Update
Thank you,
I will try tonight.
I will try tonight.
-
- Active Poster
- Posts: 17
- Joined: Fri Nov 06, 2020 12:36 am
Re: Image Update
Still having difficulties.
I have a new computer - with lots of memory - so I know that is not the issue.
Program starts and appears to be running well -then craps out - last run was at about the 240th image being displayed.
FMX.Surfaces at
procedure TBitmapSurface.SetSize(const AWidth, AHeight: Integer; const APixelFormat: TPixelFormat);
ReallocMem(FBits, NumOfBytes); is highlighted.
Error is Exception class EOutofMemory with Message 'Out of Memory'
This program worked well - same code for Windows 64 bit - but keeps crapping out on Windows 32 bit. The only difference now is I want a database (SQLite) to store the image names. Earlier - version just listed names into a ListBox.
I would prefer 64 bit, but there are no solutions ? for FireDac database - on a Standalone Executable for 64 bit.
( my other posting )
Frustrating -
on 32 bit database is great - but images fail
64 bit images are good, but no DB.
Ideas ?
Thank you.
Andrew
I have a new computer - with lots of memory - so I know that is not the issue.
Program starts and appears to be running well -then craps out - last run was at about the 240th image being displayed.
FMX.Surfaces at
procedure TBitmapSurface.SetSize(const AWidth, AHeight: Integer; const APixelFormat: TPixelFormat);
ReallocMem(FBits, NumOfBytes); is highlighted.
Error is Exception class EOutofMemory with Message 'Out of Memory'
This program worked well - same code for Windows 64 bit - but keeps crapping out on Windows 32 bit. The only difference now is I want a database (SQLite) to store the image names. Earlier - version just listed names into a ListBox.
I would prefer 64 bit, but there are no solutions ? for FireDac database - on a Standalone Executable for 64 bit.
( my other posting )
Frustrating -
on 32 bit database is great - but images fail
64 bit images are good, but no DB.
Ideas ?
Thank you.
Andrew
-
- Active Poster
- Posts: 17
- Joined: Fri Nov 06, 2020 12:36 am
Re: Image Update
If I run my program on 64 Bit, with
Project Options :
Packages | Runtime Packages | Link with runtime packages = true
and
C++ Linker | Link with Dynamoc RTL = true
Then my program runs exactly the way I want, tested - went through 1400 images perfectly.
Problem is this is not a stand alone executable anymore, and cannot be distributed as is.
This ties to my other post - how to make FireDac portable on Win64 ?
Any ideas
Thank you.
Andrew
Project Options :
Packages | Runtime Packages | Link with runtime packages = true
and
C++ Linker | Link with Dynamoc RTL = true
Then my program runs exactly the way I want, tested - went through 1400 images perfectly.
Problem is this is not a stand alone executable anymore, and cannot be distributed as is.
This ties to my other post - how to make FireDac portable on Win64 ?
Any ideas
Thank you.
Andrew