Memory Leak in CopyEntity()?
BlitzMax Forums/MiniB3D Module/Memory Leak in CopyEntity()?
| ||
This works sometimes, sometimes not, and when I set nm=20000 it never works, and the program crashes with the error "Unhandled Exception:Unhandled Memory Exception Error" at the line with CopyEntity(). I'm using MiniB3D Extended 0.41.Global mesh0:TEntity=LoadMesh("oildrum2.b3d")
Const nm:Long=10000:Long
Global mesh:TEntity
Global n:Long
For n=1 To nm
mesh=mesh0.CopyEntity()
PositionEntity mesh,Rnd(-8000,8000),0,Rnd(-8000,8000)
RotateEntity mesh,0,Rnd(360),0
Next |
| ||
| Yeah, a stupid bug integrated by me ;) I was hoping noone else here will notice it till next release. The bug is related to the shadowfunctions. There is a big Array in TMesh.bmx /TMesh --> Field Tri:TShadowTriangle, making this initially to a size of 0 or 1 will solve it but will break stencil shadows. After changing the TMesh.bmx you have rebuild minib3d ;) Is fixed in the next release. |
| ||
| Ok, thanks for the quick fix info. Now I was able to create 500,000 entities. |
| ||
| what does "10000:Long" that do? |
| ||
| Well, I kept changing the value from 1000 to 1000000, so I wanted to make sure it's treated as Long, and not as Int where the max value is 32768 in C. I thought it would kinda do the same job as "const nm=10000L" in C language. |