Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: cannot print many-linestrings #3830

Closed
remyoudompheng opened this issue Jul 15, 2012 · 2 comments
Closed

testing: cannot print many-linestrings #3830

remyoudompheng opened this issue Jul 15, 2012 · 2 comments

Comments

@remyoudompheng
Copy link
Contributor

What steps will reproduce the problem?
1. Run "go test -v" on this file:

package p

import (
      "bytes"
      "fmt"
      "testing"
)

func TestTest(t *testing.T) {
      buf := new(bytes.Buffer)
      for i := 1; i < 50000; i++ {
            fmt.Fprintf(buf, "number %d\n", i)
      }
      t.Log(buf.String())
}

What is the expected output? What do you see instead?

Expected:
=== RUN TestTest
--- PASS: TestTest (0.06 seconds)
pkg_test.go:14:         number 1
                number 2
                number 3
                ...
                number 49997
                number 49998
                number 49999

                PASS
ok      testmap 10.129s

Got:
=== RUN TestTest
throw: runtime: out of memory

goroutine 3 [running]:
----- stack segment boundary -----
testing.decorate(0xf8b095f00d, 0x9400d, 0x9401a00000000, 0xf8b095f00d, 0x9400d, ...)
    /usr/lib/go/src/pkg/testing/testing.go:149 +0x21a
testing.decorate(0xf8b095f000, 0x9401a, 0x9402600000000, 0xf8b08ca00d, 0x94019, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
testing.decorate(0xf8b08ca000, 0x94026, 0x9403200000000, 0xf8b082400d, 0x94025, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
...
testing.decorate(0xf8ad642000, 0x943f2, 0x943fe00000000, 0xf8ad5ad00d, 0x943f1, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
testing.decorate(0xf8ad5ad000, 0x943fe, 0x9440a00000000, 0xf8ad50700d, 0x943fd, ...)
    /usr/lib/go/src/pkg/testing/testing.go:158 +0x33c
created by testing.RunTests
    /usr/lib/go/src/pkg/testing/testing.go:349 +0x782

goroutine 1 [chan receive]:
testing.RunTests(0x400c00, 0x5604a8, 0x100000001, 0x1, 0x5564a0, ...)
    /usr/lib/go/src/pkg/testing/testing.go:350 +0x7a5
testing.Main(0x400c00, 0x5604a8, 0x100000001, 0x5657c0, 0x0, ...)
    /usr/lib/go/src/pkg/testing/testing.go:285 +0x7a
main.main()
    /tmp/go-build554597359/testmap/_test/_testmain.go:43 +0x91

goroutine 2 [syscall]:
created by runtime.main
    /build/src/go/src/pkg/runtime/proc.c:221
exit status 2
FAIL    testmap 1.840s

Please use labels and text to provide additional information.
@robpike
Copy link
Contributor

robpike commented Jul 16, 2012

Comment 1:

Labels changed: added priority-soon, removed priority-triage.

Status changed to Started.

@remyoudompheng
Copy link
Contributor Author

Comment 2:

This issue was closed by revision dd78f74.

Status changed to Fixed.

gopherbot pushed a commit that referenced this issue May 11, 2015
…lines.

««« backport 5e7fd762f356
testing: fix memory blowup when formatting many lines.

Fixes #3830.

R=golang-dev, r
CC=golang-dev, remy
https://golang.org/cl/6373047

»»»
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants