Skip to content

create new object memory leak during physical simulation #149

@posszhang

Description

@posszhang

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)
	}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions