<p dir="auto">by <strong>mux2005</strong>:</p>
<pre class="notranslate">What steps will reproduce the problem?

Run the attached program.


What is the expected output?

Something like this

40836728
53903472
79921352
105976016
105976016
&lt;last number repeated&gt;

What do you see instead?

The memory usage keeps increasing till the program dies with out of memory.


Which compiler are you using (5g, 6g, 8g, gccgo)?

8g

Which operating system are you using?

Ubuntu 10.04 32bit


Which version are you using?  (run 'go version')

go version go1.0.2 +2d8bc3c94ecb
(from <a href="http://ppa.launchpad.net/gophers/go/ubuntu/)" rel="nofollow">http://ppa.launchpad.net/gophers/go/ubuntu/)</a>
Judged by the hg revision this seems to be go 1.0.3 even though the version string still
says 1.0.2.


Please provide any additional information below.

1. The problem depends on the size of fragment_size in the example program. Up to a
certain size everything is fine, the memory usage stabilizes. But once it exceeds the
safe number there is unlimited growth.

2. I came upon this problem while examining why our server application keeps crashing
with out of memory. In that application the problem occurs when the String() function on
large (about 20MB) bytes.Buffer objects is called repeatedly. Either the strings or the
buffers or both never get freed even after references to both have been dropped.

3. The problem does not occur with golang-tip from the gophers PPA, but I don't know if
this is because of an actual fix in the GC or because the optimizer optimizes away some
of the useless code. I cannot test golang-tip with our actual server application because
golang-tip is still too buggy (The application compiles but doesn't pass the regression
test suite).</pre>
<p dir="auto">Attachments:</p>
<ol dir="auto">
<li><a href="https://storage.googleapis.com/go-attachment/5109/0/testgarbage.go" rel="nofollow">testgarbage.go</a> (731 bytes)</li>
</ol>
<pre class="notranslate">What steps will reproduce the problem?
1. Checkout the latest version of the Go repository and build on Windows 7 X64 for
AMD64. Build using MINGW x64 GCC version  4.7.0 20120113.
2. Checkout the latest version of mgodbc from <a href="https://bitbucket.org/miquella/mgodbc" rel="nofollow">https://bitbucket.org/miquella/mgodbc</a> and
build.  I had to make two minor modifications to change from SQLPOINTER TO SQLLEN to get
it to compile.  The file I used is attached.
3.  Compile the file hello.go.
4.  Run GDB hello
5.  Set a breakpoint on fmt.Println
6.  Run the program and it will crash.

What is the expected output?
The debugger will stop at fmt.Println

What do you see instead?
The debugger crashes and exists.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Windowx 7 X64

Which revision are you using?  (hg identify)
43cf9b39b647 weekly/weekly.2012-02-14

Please provide any additional information below.
Files are attached.  If I run the program without debugging, it executes successfully. 
The SQL Server database version is 2008.</pre>
<p dir="auto">Attachments:</p>
<ol dir="auto">
<li><a href="https://storage.googleapis.com/go-attachment/3047/0/hello.go" rel="nofollow">hello.go</a> (867 bytes)</li>
<li><a href="https://storage.googleapis.com/go-attachment/3047/0/mgodbc.go" rel="nofollow">mgodbc.go</a> (19376 bytes)</li>
</ol>