]> Repositorios git - scryer-prolog.git/commit
Fix allocate_pstr randomly refusing to properly allocate memory
authorEmilie Burgun <[email protected]>
Sun, 29 Dec 2024 22:54:03 +0000 (23:54 +0100)
committerMark Thom <[email protected]>
Tue, 8 Jul 2025 04:59:50 +0000 (21:59 -0700)
commit15f1320d055e96296046cdf2f82bfcf77d83e093
tree0b58b675ce93a75b01281e002d664d7c4966df0e
parent7b357ba84dabdcd424c0c57c3328239c620bc47e
Fix allocate_pstr randomly refusing to properly allocate memory

This one was a toughie: it turns out that using `ptr::align_of()`` was
a bad idea, since the buffer in `Heap` itself is not aligned to
`Heap::heap_cell_alignment()`, so `ptr::align_of()` would sometimes
return lower values than expected.

That made for an heisenbug: if the alignment of the heap happened to be 4,
then the bug wouldn't trigger.
src/heap_iter.rs
src/machine/heap.rs