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

runtime/debug: WriteHeapDump does not write a heapdump for go1.3beta2 windows #8119

gopherbot opened this issue May 29, 2014 · 7 comments


Copy link

@gopherbot gopherbot commented May 29, 2014

by marcel.lanz:

What does 'go version' print?
go version go1.3beta2 windows/386

What steps reproduce the problem?
build and run the programm.

What happened?
It produced a file named heapdump_win32 but of size 0 bytes

What should have happened instead?
it should write a heapdump to a file named heapdump_win32 with file size > 0 bytes

Please provide any additional information below:
Windows is Windows7, 64Bit
runtime/debug.WriteHeapDump works on OSX with: go version go1.3beta2 darwin/amd64

package main

import (

func main() {

    fmt.Println("writing heapdump")
    f, err := os.Create("heapdump_wind32")
    if err != nil {


produces a file of 0 bytes on Windows and 137410 bytes on OSX
Copy link

@ianlancetaylor ianlancetaylor commented May 29, 2014

Comment 1:

Labels changed: added repo-main, release-go1.4.

Copy link

@ianlancetaylor ianlancetaylor commented May 29, 2014

Comment 2:

Labels changed: added os-windows.

Copy link

@randall77 randall77 commented May 29, 2014

Comment 3:

Owner changed to @randall77.

Copy link

@randall77 randall77 commented May 29, 2014

Comment 4:

It looks like our windows write() implementation only handles stdout and stderr file
descriptors.  This is going to be nontrivial to fix.  Any windows experts out there know
how to write to a os.Create().Fd()?  Is it even possible?
runtime·write(int32 fd, void *buf, int32 n)
    void *handle;
    uint32 written;
    written = 0;
    switch(fd) {
    case 1:
        handle = runtime·stdcall(runtime·GetStdHandle, 1, (uintptr)-11);
    case 2:
        handle = runtime·stdcall(runtime·GetStdHandle, 1, (uintptr)-12);
        return -1;
    runtime·stdcall(runtime·WriteFile, 5, handle, buf, (uintptr)n, &written, (uintptr)0);
    return written;
Copy link

@minux minux commented May 29, 2014

Comment 5:

I will fix this one. heapdump is introduced in this cycle, so i think we can
fix it before 1.3.

Labels changed: added release-go1.3maybe, removed release-go1.4.

Copy link

@gopherbot gopherbot commented May 30, 2014

Comment 6:

CL mentions this issue.
Copy link

@minux minux commented May 31, 2014

Comment 7:

This issue was closed by revision a68b9be.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#8119.

LGTM=khr, rsc
R=alex.brainman, khr, bradfitz, rsc
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants