Project

General

Profile

Actions

Bug #3193

closed

assertion: z->z_NFree > 0 in _slaballoc

Added by tse over 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
06/16/2019
Due date:
% Done:

0%

Estimated time:

Description

I'm getting "assertion: z->z_NFree > 0 in _slaballoc" when malloc'ing
memory in a second thread it happens on the 31st or 32nd malloc

Kernel is DragonFly v5.4.2-RELEASE

As it stands, the code requires jack and midi to be setup, but I could try
and reduce it to a simpler test case if that's helpful

And if it's in any-way helpful, it looks roughly like this:

// size enough to store frames of input, dynamically updatable by jack
_Atomic size_t buf_size;
// ring of pointers to bufs for jack to copy data into
#define ringBufs_MAX 24
struct Recording*ringBufs[ringBufs_MAX];
_Atomic uint32_t ringBufs_dirty, ringBufs_clean; // positions in ring

int ringBuf_fill(void*data) {
struct Data*d = (struct Data*)data;
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_NORMAL);
while(true) {
// could change to a cond-var
while((d->ringBufs_dirty+1)%ringBufs_MAX ==
atomic_load(&d->ringBufs_clean)) {}
d->buf_size = atomic_load(&d->buf_size);
d->ringBufs[d->ringBufs_dirty] = malloc(d->buf_size);
atomic_store(&d->ringBufs_dirty, (d->ringBufs_dirty+1)%ringBufs_MAX); } }

Actions

Also available in: Atom PDF