Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    How do you free up memory?

    Bug Reporting (FUZE 4 Nintendo Switch)
    3
    3
    220
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cshep99 last edited by

      I made a simple program that uses a for loop to create a huge array of color vectors then converts that to an image using uploadImage() then displays the image, frees the image, and repeats. It displays static on the screen at about 14-15fps. I noticed free memory starts decreasing immediately when running it, I thought Freeimage() would prevent that, but it makes no difference whether it's there or not. Memory decreases at 2mb per second untill it reaches 32mb then fuze4 crashes. here is the code I'm using:

      height = gHeight()/8
      width = gWidth()/8
      Array screenBuffer[height*width]
      
      Loop
        FillImageBuffer()
        imageBuffer= Uploadimage(screenBuffer,width,height,false)
        Drawimage (imageBuffer,0,0,8)
        Update()
        Clear()
        Freeimage(imageBuffer)
      Repeat
      
      Function FillImageBuffer()
        For I=0 to height*width step 1 loop
          c=random (255)/255
          screenBuffer[I] ={c,c,c,1}
        Repeat
      Return void
      

      I also noticed that free memory doesn't reset when going between editor and running. Nor does it reset when switching programs. The only way I can reset the free memory is to close fuze4 and reopen it. Am I doing something wrong?

      1 Reply Last reply Reply Quote 1
      • pianofire
        pianofire Fuze Team last edited by

        @cshep99 this looks like a memory leak to me so I will move this topic to bug reporting. The problem seems to be specific to the uploadimage function as I am not getting the same effect with createimage

        1 Reply Last reply Reply Quote 3
        • Martin
          Martin Fuze Team last edited by

          Mind you, congrats on getting free memory down to 32MB. I had no idea that was possible as I've never seen it drop by much :)

          1 Reply Last reply Reply Quote 1
          • First post
            Last post