Last active
December 20, 2015 22:09
-
-
Save ZachMassia/6202891 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (b *Board) run() { | |
for { | |
msg := message{} | |
header, err := b.buf.ReadByte() // Line 123 in my full file. | |
if err != nil { | |
log.Printf("Error reading message header: %s", err) | |
return | |
} | |
// Sysex commands have their own header so check for that first. | |
switch { | |
case header == startSysex: | |
// Read until sysexEnd | |
data, err := b.buf.ReadBytes(endSysex) | |
if err != nil { | |
log.Printf("Error reading sysex data: %s", err) | |
return | |
} | |
msg.t = sysexMsg | |
msg.data = append([]byte{header}, data...) | |
b.handleCallback(msg) | |
default: | |
// Read the two MIDI data bytes | |
lsb, err := b.buf.ReadByte() | |
if err != nil { | |
log.Printf("Error reading MIDI lsb: %s", err) | |
return | |
} | |
msb, err := b.buf.ReadByte() | |
if err != nil { | |
log.Printf("Error reading MIDI msb: %s", err) | |
return | |
} | |
msg.t = midiMsg | |
msg.data = []byte{header, lsb, msb} | |
b.handleCallback(msg) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ gizmo_led ./gizmo_led | |
fatal error: out of memory (stackcacherefill) | |
goroutine 1 [running]: | |
[fp=0x7fcb654e1cc0] runtime.park(0x0, 0x0, 0x426d20) | |
/usr/lib/go/src/pkg/runtime/proc.c:1175 +0x64 | |
goroutine 2 [syscall]: | |
goroutine 4 [syscall]: | |
syscall.Syscall() | |
/usr/lib/go/src/pkg/syscall/asm_linux_amd64.s:16 +0x5 | |
syscall.read(0x3, 0xc200074000, 0x1000, 0x1000, 0x100000000000003, ...) | |
/usr/lib/go/src/pkg/syscall/zerrors_linux_amd64.go:2337 +0x70 | |
syscall.Read(0x3, 0xc200074000, 0x1000, 0x1000, 0x408c58, ...) | |
/usr/lib/go/src/pkg/syscall/syscall_unix.go:132 +0x5a | |
os.(*File).read(0xc2000009b8, 0xc200074000, 0x1000, 0x1000, 0x412e54, ...) | |
/usr/lib/go/src/pkg/os/file_unix.go:174 +0x60 | |
os.(*File).Read(0xc2000009b8, 0xc200074000, 0x1000, 0x1000, 0x0, ...) | |
/usr/lib/go/src/pkg/os/file.go:95 +0x96 | |
bufio.(*Reader).fill(0xc2000730c0) | |
/usr/lib/go/src/pkg/bufio/bufio.go:79 +0x10c | |
bufio.(*Reader).ReadByte(0xc2000730c0, 0x1b, 0x0, 0x0) | |
/usr/lib/go/src/pkg/bufio/bufio.go:171 +0x7d | |
github.com/ZachMassia/GoGoGadget.(*Board).run(0xc200044140) | |
/home/zach/dev/lang/go/src/github.com/ZachMassia/GoGoGadget/board.go:123 +0x57 | |
created by github.com/ZachMassia/GoGoGadget.(*Board).init | |
/home/zach/dev/lang/go/src/github.com/ZachMassia/GoGoGadget/board.go:101 +0x205 | |
➜ gizmo_led free -m | |
total used free shared buffers cached | |
Mem: 5884 1762 4122 0 7 480 | |
-/+ buffers/cache: 1274 4609 | |
Swap: 0 0 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment