Open posszhang opened 3 months ago
Performs normally in Windows, but leaks in Linux The above is Golang code, but the performance of pure C++testing is also the same
func testmem() { scene, _ := gophysx.NewScene("") fmt.Println("newscene") for j := 0; j < 400; j++ { // simulate fetchResult scene.Update(1.0 / 40.0) scene.CreateBoxStatic(gophysx.Vector3{1, 2, 3}, gophysx.Vector3{1, 1, 1}) scene.CreateBoxStatic(gophysx.Vector3{1, 2, 3}, gophysx.Vector3{1, 1, 1}) scene.CreateBoxStatic(gophysx.Vector3{1, 2, 3}, gophysx.Vector3{1, 1, 1}) scene.CreateBoxStatic(gophysx.Vector3{1, 2, 3}, gophysx.Vector3{1, 1, 1}) scene.CreateBoxStatic(gophysx.Vector3{1, 2, 3}, gophysx.Vector3{1, 1, 1}) } scene.Release() fmt.Println("releasescene") } func main() { for i := 0; i != 10; i++ { go func() { for j := 0; j != 1000; j++ { testmem() } }() } for { runtime.GC() debug.FreeOSMemory() time.Sleep(1 * time.Second) } }
linux glibc need malloc_trim but cgo have leak memory
Performs normally in Windows, but leaks in Linux The above is Golang code, but the performance of pure C++testing is also the same