but the processes virtual address space does not shrink -- ie, your
program will not return memory to the operating system. On Unix based
platforms we use a system call to tell the operating system that it
can reclaim unused parts of the heap, this facility is not available
on Windows platforms.
On Fri, Apr 12, 2013 at 12:01 PM, junyi sun wrote:
Hi all,
I am studying Go, and find that it is very interesting and "battery"
included.
In this mail, I want to ask something about the garbage collection rules of
Go.
For example, in the following program.
package main
import (
"math/rand"
"time"
"runtime"
)
func DoSomeThing(){
a := make([][]interface{},10000)
for i:=0;i<len(a);i++{
a[i] = make([]interface{},10000)
for j:=0;j<len(a[i]);j++{
a[i][j] = rand.Float64()
}
}
}
func main() {
DoSomeThing()
for {
println("idle")
runtime.GC()
time.Sleep(2*time.Second)
}
}
It will allocate 1.6 GB memory on my windows x64 machine with go1.1 beta2.
I am confused that why the memory allocated by DoSometThing() is not freed?
Thanks
Junyi
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--Hi all,
I am studying Go, and find that it is very interesting and "battery"
included.
In this mail, I want to ask something about the garbage collection rules of
Go.
For example, in the following program.
package main
import (
"math/rand"
"time"
"runtime"
)
func DoSomeThing(){
a := make([][]interface{},10000)
for i:=0;i<len(a);i++{
a[i] = make([]interface{},10000)
for j:=0;j<len(a[i]);j++{
a[i][j] = rand.Float64()
}
}
}
func main() {
DoSomeThing()
for {
println("idle")
runtime.GC()
time.Sleep(2*time.Second)
}
}
It will allocate 1.6 GB memory on my windows x64 machine with go1.1 beta2.
I am confused that why the memory allocated by DoSometThing() is not freed?
Thanks
Junyi
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.