I have a project that at some point I need to display many images on the screen at the same time
These images are registered by the user, so before I didn't pay attention to the size of the images
one of the users was registering 11MB png images
which at some point caused the app to crash because the RAM consumption was going too high
Then I did a treatment to resize the images and it worked fine...
But I can't stop thinking, what if I want to use the images with the best possible resolution?
even on devices with high performance, the RAM consumption is huge, eight 11MB images displayed on the screen at the same time use 500MB+
i have a loop that create frames
and do something like:
for product in menu do
begin
frame:= TFrmImageItem.create(product, 'imagePath');
layoutFrmImageItem.addObject(frame);
end;
constructor TFrmImageItem.create(product:TProduct, imagepath:string);
var
bitmap:TBitmap
begin
lbName.text:=product.name;
bitmap := tbitmap.create;
bitmap.setSize(TSize.create(200,200));
bitmap. LoadFromFile(imagePath);
Timage.bitmap.assign(bitmap);
bitmap.free;
end
i wonder what else can be done to reduce the memory consuption without resizing the images
i've alredy implemented a virtualization method to set frameVisible:=false when the frame is not on the screen
also a double buffer method (wich didn't work well)
i wonder if you guys can provide me any ideas
maybe the memory is skyrocketing because i'm using frames?