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

Slice can not be collected by GC in 8g #3900

Closed
gopherbot opened this issue Aug 3, 2012 · 5 comments
Closed

Slice can not be collected by GC in 8g #3900

gopherbot opened this issue Aug 3, 2012 · 5 comments

Comments

@gopherbot
Copy link

by zhaihj233:

var base int64 = int64(header.IndexLength + 0x01)
    for i := 0; i < int(header.Length); i++ {
        mbuffer := make([]byte, indexs[i].length)
        f.ReadAt(mbuffer, int64(indexs[i].offset)+base)
    }

In this example, f is *os.File which point to a localfile. "indexs" is an
index array which records offset and length of the data in f.

What is the expected output?

mbuffer should be collected by GC. 

What do you see instead?

Memory usage continues raising, even adding runtime.GC() can not do any help

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

8g

Which operating system are you using?

Windows 7 x64

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

GO VER 1.0.2

Please provide any additional information below.

When compiling the same program with 6g, everything seems to be fine.
@davecheney
Copy link
Contributor

Comment 1:

Can you please post a complete runnable sample so I can try to verify this on my 32 bit
systems.

Status changed to WaitingForReply.

@gopherbot
Copy link
Author

Comment 2 by zhaihj233:

Attached file is the source code and test data where I found this problem.(extract.go
line 171)
I've tried to delete line 173-194 but nothing happened,so I think it may be the GC's bug.

Attachments:

  1. nss.npa (192673 bytes)
  2. extract.go (5988 bytes)

@davecheney
Copy link
Contributor

Comment 3:

Can you please post a complete runnable sample so I can try to verify this on my 32 bit
systems.

@gopherbot
Copy link
Author

Comment 4 by zhaihj233:

Nitro+32 attached is the program where i found this problem.
I sent a test data in the last email but I'm wondering whether it has really reached.....

Attachments:

  1. Nitro+32.exe.tar.gz (831962 bytes)
  2. Nitro+.go (9759 bytes)

@rsc
Copy link
Contributor

rsc commented Sep 12, 2012

Comment 5:

This is either a dup of 353 or a dup of 909. I'm going to say 909.

Status changed to Duplicate.

Merged into issue #909.

@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