B4J Question How?: much RAM memory for raster bitmaps

peacemaker

Expert
Licensed User
Longtime User
Hi, All

Is there way for B4J Java app to use ... much RAM memory for work with raster bitmaps ?
I mean - to check the available RAM on the PC and use in Java app, say, 30%.

If user is using really big raster bitmaps (photos to be viewed with zoom in and out), and PC is with lots of GB of RAM - how to correctly let him use it without the RAM memory issue as here ?
 

Daestrum

Expert
Licensed User
Longtime User
You could set -Xms and -Xmx but you need to set them before your app starts (you cant see how much memory you have, then try to set them from your app). #VirtualMachineArgs
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
I have tried to set "-Dprism.maxvram=2G" - and zooming now is 5.5 times wider without those error.
The Windows Task manager shows really bigger used RAM of the process.

Making > 2G makes small changes.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
When you zoom in are you actually drawing a bigger image?
What I mean is if image is 100 x 100 and you zoom 2x - does the image end up at 200 x 200.

An alternative is to use imageview with a veiwport.
If the image is 100 x 100 and imageview is 100 x 100 and viewport is 100 x 100 = zoom x1
If you change viewport to 50 x 50 = zoom x2
If you change to 10 x 10 = zoom x10

and it doesnt use more memory as the imageview stays the same size. If you use canvas you could snapshot the imageview and put into canvas.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
actually drawing a bigger image?
I use Erel's ZoomImageView class, 2 pcs on the screen.
And the subject is about really big photos (of the PCB that can be big), say, like 4K x 3K area, and at FullHD monitor they are zoomed from say 0.2 to 15.
And anyway the photos sizes depend on user's choice.
 

Attachments

  • TempDownload.png
    TempDownload.png
    101.4 KB · Views: 15
  • TempDownload.png
    TempDownload.png
    179.8 KB · Views: 16
  • Screen_Recorder-_20250123142322_resized_resized.gif
    Screen_Recorder-_20250123142322_resized_resized.gif
    316.2 KB · Views: 13
Last edited:
Upvote 0
Top