FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Memory error
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Memory error

Posted: Thu Oct 10, 2024 10:10 AM
I'm trying to glue 2 bitmap files and save them to a files:

map1.jpg - https://cloud.mail.ru/public/yDjE/jFfNgNw7s
map2.jpg - https://cloud.mail.ru/public/UpXQ/CxwNAb4Nc
Code (fw): Select all Collapse
hBmp:=FW_StitchImages(path+"\map1.jpg", path+"\map2.jpg", "B")
FW_SaveImage(hBmp, path+"\map.jpg")
When writing to a file, I get a memory error: hb_xgrab can't allocate memory

How to solve this problem ?
Posts: 318
Joined: Fri Jan 14, 2022 08:37 AM

Re: Memory error

Posted: Thu Oct 10, 2024 10:51 AM
Please, try so,
Code (fw): Select all Collapse
hb_GCAll(.t.)
hBmp:=FW_StitchImages(path+"\map1.jpg", path+"\map2.jpg", "B")
hb_GCAll(.t.)
FW_SaveImage(hBmp, path+"\map.jpg")
DeleteObject(hBmp)
hb_GCAll(.t.)
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: Memory error

Posted: Thu Oct 10, 2024 11:26 AM
It breaks anyway :cry:
Posts: 8523
Joined: Tue Dec 20, 2005 07:36 PM

Re: Memory error

Posted: Thu Oct 10, 2024 12:00 PM
https://fivetechsupport.com/forums/viewtopic.php?f=3&t=44225&start=0

Do the same test with 2 smaller .jpg files, to make sure it's not the size of the images that blows up the memory.

Haga la misma prueba con 2 archivos .jpg más pequeños, para asegurarse de que no sea el tamaño de las imágenes lo que explote la memoria.

Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: Memory error

Posted: Thu Oct 10, 2024 12:23 PM

Why do I need a link to my topic ?

There I tried to glue 2 files with a size of about 12 mG and broke down from memory.

Now I have learned how to compress jpg files by about 9 times (up to 1.5 mG), but I get the same error

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: Memory error

Posted: Thu Oct 10, 2024 12:38 PM

Can I see a little but still compilable and runnable sample showing the problem (with the 2 images), please?

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Memory error

Posted: Sat Oct 12, 2024 04:59 PM
I could see the images but could not download them.
It appeared to me that the size of each image is very huge and both together may not be fitting in the memory.
Then this should probably work with 64 bits application.

Mr. Natter
Can you please provide this information for each jpg?
Code (fw): Select all Collapse
aImage := FW_ReadImage( nil, cJpeg )
? aImage[3], aImage[4]   // width, height
PalBmpFree( aImage )
Also, size of the file on disk in bytes
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion