<p dir="auto">by <strong>plnordahl</strong>:</p>
<pre class="notranslate">Running Mavericks 10.9.2 and using the patch from
<a href="https://groups.google.com/forum/#" rel="nofollow">https://groups.google.com/forum/#</a>!msg/golang-codereviews/it4yhth9fWM/TxcE1Yx6AUMJ (issue
7510) on release-branch.go1.2, I'm not seeing the variable names of int, string, float,
or map variables in a simple program. I do however see names for slices, arrays, and
struct/struct members in the output. Below is some code to reproduce the behavior.

One program, which will be loaded for it's DWARF data:

package main

import "fmt"

func main() {
    myInt := 42
    mySecondInt := 41
        fmt.Println(myInt, mySecondInt)

    myArray := [2]string{"hello", "world"}
    fmt.Println(myArray)

    myString := "foo"
    fmt.Println(myString)

    mySlice := []int{1, 2, 3}
    fmt.Println(mySlice)

    myFloat := 42.424242
    fmt.Println(myFloat)

    myMap := make(map[string]string)
    fmt.Println(myMap)

    myStruct := myStructType{"bleh", 999, "hm"}
    fmt.Println(myStruct)
}

type myStructType struct {
    Bleh string
    Blerg int
    Foo  string
}



...and the second, which just loads the Mach-O binary and prints each entry's offset,
tag, children, and fields (pipe the output of this program into grep to see the behavior
I describe).

package main

import (
    "debug/macho"
    "fmt"
    "log"
)

func main() {
    m, err := macho.Open("&lt;put the path to where your test binary is located&gt;")
    if err != nil {
        log.Fatalf("Couldn't open MACH-O file: %s\n", err)
    }

    d, err := m.DWARF()
    if err != nil {
        log.Fatalf("Couldn't read DWARF info: %s\n", err)
    }

    r := d.Reader()

    for {
        entry, err := r.Next()
        if err != nil {
            log.Fatalf("Current offset is invalid or undecodable. %s", err)
        }
        if entry == nil {
            fmt.Println("Reached the end of the entry stream.")
            return
        }

        fmt.Println("Entry --- offset: ", entry.Offset,
            " tag: ", entry.Tag, " children: ", entry.Children,
            " field: ", entry.Field)
    }

    return  
}</pre>
<p dir="auto">by <strong>seanerussell</strong>:</p>
<pre class="notranslate">What steps will reproduce the problem?
1. Compile the attached file (steps to compile listed below)
2. Execute on Windows
3. Watch the memory use with Resource Monitor

The application memory use increases at a rate of about 1KB every 5s until it exceeds
the stack (heap?) space and crashes.

I'm using Go 6d7136d74b65 weekly/weekly.2011-10-18 and am compiling on Linux,
cross-compiling for Windows using gb (go-gb.googlecode.com) via "GOOS=windows
gb"; 6g/l are the compilers being used.

The Linux machine is 2.6.32-32-generic #62-Ubuntu SMP, and the code is executing on
Windows Server 2008 R2 Standard, 6-core AMD Opteron 2425 HE 2.1GHz x 2, 32GB RAM, 64-bit.

I don't see similar behavior on Linux; the process memory use does grow very slowly for
a while, but appears to eventually plateau after a few minutes.

If this isn't a memory leak, but is explained by expected behavior, could I get a
pointer to a document describing the cause?</pre>
<p dir="auto">Attachments:</p>
<ol dir="auto">
<li><a href="https://storage.googleapis.com/go-attachment/2385/0/memconsumer.go" rel="nofollow">memconsumer.go</a> (1308 bytes)</li>
</ol>