Memory available for bitmaps
alex glez

486/5000
Hi, I would like to know if there is any memory limit in the bitmaps load. I have tried in two computers and when I consume almost 2 GB my program fails, although there are several GB of free RAM. What I do is load thumbnails of the photos of a folder, with Bitmaps of 500x333 .. The program works with 120 thumbnails but with 200 or more fails even if the system has a lot of free memory. Do I need to reserve system memory? as?

Thank you very much, greetings

Chris Katko

Are you in 32-bit mode? (Program/compiled in 32-bit, 32-bit compiled library, Windows 32-bit version, or CPU is 32-bit) If so, that's the most memory you can consume in a single app:

https://www.wikiwand.com/en/2_GB_limit

Audric

The above answer is correct, but I wonder how you reach 2Gb with so few images.
500 x 333 x 4 (32bit RGBA) x 200 = 127Mb.

alex glez

Hi. If it is in 32 bits. Now I understand everything. Limit 2 GB. It is a program that reads a memory card with 200 photos for example, reduces them to miniatures and adds a layer (joins the two images) and you can move the layer, zoom and many other things. Then export to a normal JPG. Everything works but I did not know about the limit. It emulates a bit what digital laboratories like NORITSU or EPSON minilab do.

Thanks for the help. I will save the thumbnails in the SSD and not in memory.
a greeting

Edgar Reynaldo

I would preload the thumbs, and only load one full image at a time on demand. You may have a memory leak as well.

Chris Katko

If you can just switch to 64-bit mode, that'll fix your problem with the least hassle.

You may have a memory leak as well.

Yeah, if he's loading bitmaps but doesn't need them all in memory at once, then he needs to either free them (or he forgot to free them) so it's ballooning in size with each new bitmap.

alex glez

Yes, I am trying to do it, I reduce it to miniatures and then I load them in 4 divided into 4 pages in 4 .. although it works very well and fast so, I am still trying to solve an error .. patience .. uff

Neil Roy

You are limited by the amount of memory on your video card when it comes to textures. Not just your system memory. Allegro 5 creates video bitmaps by default, so unless you specify memory bitmaps, it will all go to your video card. If it has limited memory, you will have problems I would imagine.

Also, your operating system will use much of that RAM for itself, so you don't have the entire 2G to yourself. All other programs running are using some as well.

If you don't NEED video bitmaps, perhaps specify them as being memory bitmaps?

alex glez

I will select the RAM memory, so I will have more certainty of where the bitmap is created. It seems that I have already corrected the problem of memory, now it's time to perfect the program a bit more and that's it.

By the way, I have another question, although I do not know if I have to open another thread, it is the next one ..

My program sometimes thinks that the mouse button is pressed even if it is not true and the only way I have to clean the buffer (I do not know if it works like the keyboard) is like this ...

q000: al_get_mouse_state(&raton); if (raton.button) { goto q000; }

Thread #617367. Printed from Allegro.cc