Skip to content

Instantly share code, notes, and snippets.

@ttaylorr
Last active July 12, 2017 21:22
Show Gist options
  • Save ttaylorr/21d05c2a6f727be00badce4ccd2d2aef to your computer and use it in GitHub Desktop.
Save ttaylorr/21d05c2a6f727be00badce4ccd2d2aef to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"runtime"
"time"
"github.com/git-lfs/git-lfs/git/odb/pack"
"github.com/git-lfs/git-lfs/tools/humanize"
)
func main() {
done := make(chan struct{})
go func() {
for {
select {
case <-time.After(100 * time.Millisecond):
var stat runtime.MemStats
runtime.GC()
runtime.ReadMemStats(&stat)
fmt.Fprintf(os.Stderr, "System:\t%s\n", humanize.FormatBytes(stat.Sys))
case <-done:
return
}
}
}()
for _, fpath := range os.Args {
f, err := os.Open(fpath)
if err != nil {
panic(err.Error())
}
if _, err := pack.DecodeIndex(f); err != nil {
panic(err.Error())
}
f.Close()
}
close(done)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment