Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 21:41 16 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Is there a way to manage Heap size?

Author Message
RCMAN
Newbie

Joined: 31/10/2020
Location: Canada
Posts: 29
Posted: 04:07pm 09 Dec 2020
Copy link to clipboard 
Print this post

I'm reading large sprites and getting the error "Not enough heap memory"

I looked up an option for it and didn't find one.

Can I increase it?

Thanks
RC
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10590
Posted: 04:11pm 09 Dec 2020
Copy link to clipboard 
Print this post

No
The issue is in the decoding of PNG files which use huge amounts of memory. One workaround is to convert large png to bmp read these into memory and then use sprite read to convert the image into a sprite

The other thing you can do is make sure you load sprites before setting up any array or string variables
Edited 2020-12-10 02:18 by matherp
 
RCMAN
Newbie

Joined: 31/10/2020
Location: Canada
Posts: 29
Posted: 05:37pm 09 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  No
The issue is in the decoding of PNG files which use huge amounts of memory. One workaround is to convert large png to bmp read these into memory and then use sprite read to convert the image into a sprite

The other thing you can do is make sure you load sprites before setting up any array or string variables


I converted to BMP and still getting the error.

     for i = 1 to 59

                 '  load bmp "00"+str$(i)
     if i < 10 then
        load bmp "gfx/000"+str$(i)+".bmp"
'         blit 0,0,0,256,256,256,1
       'print "000"+str$(i)+".bmp"
      sprite read i,0,0,256,256,1
        else
        load bmp "gfx/00"+str$(i)+".bmp"
'        blit 0,0,0,256,256,256,1
       sprite read i,0,0,256,256,1
       'print "00"+str$(i)
     sprite show i,100,100,0

gfx.zip

    end if


Attached the images

RC
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10590
Posted: 05:46pm 09 Dec 2020
Copy link to clipboard 
Print this post

You are simply trying to load too much data

Assume 8-bit colour mode
256x256 = 64k
*2 (original image  + screen save) = 128k
*59

= 7552K = 7M

Available memory

5M
 
RCMAN
Newbie

Joined: 31/10/2020
Location: Canada
Posts: 29
Posted: 05:48pm 09 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  You are simply trying to load too much data

Assume 8-bit colour mode
256x256 = 64k
*2 (original image  + screen save) = 128k
*59

= 7552K = 7M

Available memory

5M


Okay thanks. I'll make them smaller :)

Thanks
RC
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025