Navigation

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

    Function causes a crash

    Bug Reporting (FUZE 4 Nintendo Switch)
    crash bug function
    8
    48
    3445
    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.
    • Hector1945
      Hector1945 F last edited by

      The program is now live. Here is the code of you want to experience this yourself: NX29ZPFDDA. Please contact me if you have any idea of what is causing the crash.

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

        When you run the program with fps meter showing your using a megabyte a second.
        I put deleteshape(trailportion) after drawshape(trailportion)
        And moved
        Shpball = create etc
        Shpground and shpnet out of the function drawsprshapes()
        This slowed down the memory loss but it's still losing memory (Maybe?)
        For fps go to settings then preferences and you'll see it towards the bottom
        The problem your having is you are creating a new thing every time you call these functions.
        This is a pretty neat program. Well done.

        1 Reply Last reply Reply Quote 2
        • xevdev
          xevdev F last edited by

          Oh and it's possible for the ball can come to a complete stop.

          Hector1945 1 Reply Last reply Reply Quote 0
          • Hector1945
            Hector1945 F @xevdev last edited by

            @xevdev I put a timer to reset it if it doesn't move for 1 second

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

              Anyway, thanks for saying it's a neat program, and thanks for the idea of deleting the shapes, because that apparently solved the issue. I don't really understand because wouldn't the old value be deleted anyway when you assign a new one to a handle ?

              xevdev 1 Reply Last reply Reply Quote 1
              • Jongjungbu
                Jongjungbu F last edited by

                Xev is right that you’re creating new shapes hundreds to thousands of times. This may probably overrunning the video buffer maybe. I adjusted that in my copy of your program, but still have random crashes.

                The major problem I see causing crashing is in your DrawTrail() you are attempting to copy an array value that is out of bounds.

                ‘trail[i+1] = trail[i]’

                Here once every loop, i = -1
                This results in trail[0] = trail[-1], the latter of which is out of bounds and it crashes.

                1 Reply Last reply Reply Quote 2
                • xevdev
                  xevdev F @Hector1945 last edited by

                  @Hector1945 create will create a new one apparently.
                  So any create should be outside of a function like the createcircle because you only need to make this once.
                  Within a function or loop just deleteshape() after you finished using it.
                  I'd say when you use create it using the same handle it would make the old handle unavailable but it would all be still there.

                  1 Reply Last reply Reply Quote 3
                  • vinicity
                    vinicity F last edited by

                    Be aware that memory leaked by creating shapes and not using deleteShape() afterwards is not returned when returning to the Fuze editor. So each time you run your program, the memory will be less than before, and this will eventually cause a crash somewhere. You have to restart Fuze altogether to get the memory back.

                    1 Reply Last reply Reply Quote 4
                    • Hector1945
                      Hector1945 F last edited by

                      So I just modified the program to delete every shape after drawing it. The free memory doesn't tick down the way it used to, so that's good, however I still get the crash...

                      1 Reply Last reply Reply Quote 0
                      • Jongjungbu
                        Jongjungbu F last edited by

                        Did you fix your out of bounds array access? If you comment out the line I mention, and put a debug output that shows what i equals, then -1 will be included in the list. As well, it will stop crashing with that line commented out.

                        1 Reply Last reply Reply Quote 0
                        • Hector1945
                          Hector1945 F last edited by

                          Indeed, it stops crashing, but I need that line

                          1 Reply Last reply Reply Quote 0
                          • xevdev
                            xevdev F last edited by

                            How long before it crashes

                            1 Reply Last reply Reply Quote 0
                            • Hector1945
                              Hector1945 F last edited by

                              Well actually, restarting Fuze seems to have fixed it ! 😅 Thanks !

                              1 Reply Last reply Reply Quote 2
                              • PickleCatStars
                                PickleCatStars F last edited by

                                Keep your fps/memory meter turned on!

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