Skip to content

runtime/debug: FreeOSMemory() not working on Android 9 #37569

@YouROK

Description

@YouROK

What version of Go are you using (go version)?

GO 1.12 - 1.14

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

On android 9, on other all works

What did you do?

func main() {
	bigArr := make([]byte, 250*1024*1024)
	for i := 0; i < len(bigArr); i++ {
		bigArr[i] = byte(i)
	}
	bigArr = nil
	runtime.GC()
	debug.FreeOSMemory()
	for true {
		//Some thing works in program
		time.Sleep(time.Second)
	}
}

What did you expect to see?

I expected to see the memory in the system, but it remains in the program. If you allocate memory several times, then the program is killed by the system, but should clear it

In version 1.11.X all works in android 9, memory returning to os, but not execute on android 10. On android 5,6,7,8 all works of new golang version

Compile cmd: GOARM=7 GOOS=linux GOARCH=arm go build -o test main

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Android

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions