libtess2 icon indicating copy to clipboard operation
libtess2 copied to clipboard

setjmp in tess.c crashes when using a custom allocator

Open TylerGlaiel opened this issue 4 years ago • 0 comments

its an alignment issue because jumpbuf needs to be aligned to 16 bytes, so I had to make sure my custom allocator was aligning stuff to 16 byte boundaries (instead of 8 bytes as indicated by alignof(std::max_align_t))

it was a little bit frustrating to figure this out, so if setjmp is really absolutely necessary for memory management, then in the comment about TESSalloc it should mention that it needs to return buffers aligned to 16-byte boundaries, or add an "alignment" parameter to memalloc since I'm pretty sure only the TESStesselator needs to be aligned anyway

TylerGlaiel avatar Mar 21 '21 03:03 TylerGlaiel