GitXplorerGitXplorer
z

go-leak

public
131 stars
10 forks
1 issues

Commits

List of commits on branch master.
Unverified
a11b0b936d24d0f31314933d543e020506efb6b6

Update the README to warn that this package does not work anymore

zzimmski committed 9 years ago
Unverified
d5680872c0e7cc6d0840995f77089299fddd14bc

Move the workaround into its own init function

zzimmski committed 10 years ago
Unverified
bf28531e94390f329f05880dcf270c77f557095f

Workaround for allocation of goroutines

zzimmski committed 10 years ago
Unverified
bc0e430d143fdd28f2320fea61149aec907372d0

add a godoc badge

zzimmski committed 10 years ago
Unverified
dea62aa08a35ab912ebfefa587dbc974d7703814

do not call the function, it is a parameter

zzimmski committed 10 years ago
Unverified
6c11930af97b4c34441b8bfed650e6ef314d573a

Update README.md

zzimmski committed 10 years ago

README

The README file for this repository.

go-leak GoDoc

The std packages of Go do currently not included detection for leaks. go-leak is a package which should help you find leaks in your code. If you have any ideas on how to improve this package or have problems of any kind with it, please submit an issue through the issue tracker.

Note: This package does not work anymore. It worked for some use-cases I had with an older Go version but with >= 1.4 it does not work at all. I have it on my TODO to redo the whole thing and add some more use-cases but there are some other open source projects I have to do first. So if you have some time on your hand and would like to contribute mail me or submit an issue in the project's tracker.

Note: Since Go is scoped it is important to avoid new variables that are in the same scope as the mark-and-release calls.

goroutines

If you want to know if a function is leaking goroutines:

leaks := leak.GoRoutineLeaks(foo)

if leaks > 0 {
	panic("foo is leaking!")
}

If you want to know if a code is leaking goroutines:

m := MarkGoRoutines()

// some code

leaks := m.Release()

if leaks > 0 {
	panic("some code is leaking!")
}

memory

If you want to know if a function is leaking memory:

leaks := leak.MemoryLeaks(foo)

if leaks > 0 {
	panic("foo is leaking!")
}

If you want to know if a code is leaking memory:

m := MarkMemory()

// some code

leaks := m.Release()

if leaks > 0 {
	panic("some code is leaking!")
}