Navigation

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

    Nested for loops, memory allocation failure and graphic issue

    Bug Reporting (FUZE 4 Nintendo Switch)
    4
    7
    307
    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.
    • Tratax
      Tratax F last edited by

      Hey Team, got this entertaining crash when attempting to have some fun with 3D objects and arrays

      The memory allocation failure only occured after I attempted to put the shadow spotlight in

      Raising incase its a bug? Or is it my code being too wild :)?

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

        @Tratax Pretty sure it shouldn't do that! Please can you post a screen shot of the code and I will try it on the latest patch. I can't quite read it from the video.

        Tratax 1 Reply Last reply Reply Quote 1
        • Tratax
          Tratax F @pianofire last edited by

          @pianofire No problem, here you go:

          Here's something which may help with your testing:

          • The crashing occurs rapidly when both lines 17 and 23 for the pointShadowLight are present
          • The crashing still occurs if either is individually commented, but without the graphical flipping
          • With both removed, memory allocation errors still occur after 30 seconds or so
          1 Reply Last reply Reply Quote 1
          • Discostew
            Discostew F last edited by Discostew

            It's not a memory allocation error. It's a command memory error, in which it has too much drawing between calls to update(). Now, I've not dealt much with the 3D side of FUZE, but in your code, you began with 40 cubes, then began adding a bunch of spheres and some shadow lights with the main loop. One thing to remember is that when you use placeObject(), you are creating that object, with the system keeping a note of each one for when it draws them. The handle is a means to manipulate them after creating them, and well as to remove them when they are not used anymore. By writing over an existing handle/block variable as you create more, you essentially create a kind of memory leak, where the object is still in memory, but you can't access it. It also will continue being part of the draw calls because the system internally has a record of it. Even if you were to place that creation of objects outside of the main loop so it made a limit, that's still upwards of 20x20x20 spheres created. 8000 spheres. That's not including 400 shadow lights. Far too much to draw, hence the error long before you could pull that off.

            Also noticing that when placing/creating spheres, you're using the iteration variable to assign to an array, but the iteration begins in the negatives. Should we even be able to access an array like that?

            As for the aftermath of the error, that is certainly interesting, and kinda funny how everything is upside-down, like the vertical scaling was negatized. Certainly shouldn't happen.

            1 Reply Last reply Reply Quote 1
            • Tratax
              Tratax F last edited by

              Thanks @Discostew, good point about the handle for pointShadowLight, I've moved this out of the main loop and its displaying as I hoped:

              I was also suprised by the array access, I expected it to return some error but it decided to throw up what you've seen in the video and then the funky crash happened, so I figured I would do this bug report

              For the iterations, i'm mostly just drawing that way to experiment with learning 3D coding to test my ideas - Keen for any suggestions on how to place all the objects and have the outcome as drawn but in a more memory friendly manner!

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

                I think we can all agree there's a bug there. Regardless of what your code is or isn't doing, Fuze should NOT crash quite that spectacularly so thanks for reporting!

                I'm not able to test stuff at the moment so let's see what @pianofire comes back with on how improved the situation is with the next version.

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

                  I can confirm that this still happens and I have raised an issue

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