Nested for loops, memory allocation failure and graphic issue
-
-
@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.
-
@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
-
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 useplaceObject()
, 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.
-
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!
-
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.
-
I can confirm that this still happens and I have raised an issue