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

Occasional malloc error when adding notes #8

Open
jbmaxwell opened this issue Mar 23, 2020 · 0 comments
Open

Occasional malloc error when adding notes #8

jbmaxwell opened this issue Mar 23, 2020 · 0 comments

Comments

@jbmaxwell
Copy link

jbmaxwell commented Mar 23, 2020

I'm noticing a fairly frequent crash when calling add(note:):

SpliqsTool(50382,0x70000ee42000) malloc: *** error for object 0x600000ce9620: pointer being freed was not allocated
SpliqsTool(50382,0x70000eec5000) malloc: Heap corruption detected, free list is damaged at 0x600000cfaed0
*** Incorrect guard value: 1
SpliqsTool(50382,0x70000ee42000) malloc: *** set a breakpoint in malloc_error_break to debug
SpliqsTool(50382,0x70000eec5000) malloc: *** set a breakpoint in malloc_error_break to debug
SpliqsTool(50382,0x70000f4e9000) malloc: Heap corruption detected, free list is damaged at 0x600000ce7fd0
*** Incorrect guard value: 105553129677296
SpliqsTool(50382,0x70000f4e9000) malloc: *** set a breakpoint in malloc_error_break to debug

I'm calling it from an extension I wrote for merging events onto a given channel:

extension MidiNoteTrack {
    func add(notes: [MidiNote], mergeToChannel ch: Int) {
        for note in notes {
            let n = MidiNote(timeStamp: note.timeStamp, duration: note.duration, note: note.note, velocity: note.velocity, channel: UInt8(ch))
            self.add(note: n)
        }
    }
}

I don't see how my function could be causing it (though I obviously won't rule out the possibility) so I thought I'd report it, just in case. I am calling my function from a DispatchQueue.concurrentPerform, which contains a midiData.writeData(to:) call—could that be the problem?

I'm on macOS 10.15.3, Xcode 11.3.1, Swift 5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant