]> 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]>
Wed, 23 Apr 2025 06:32:32 +0000 (23:32 -0700)
commite1863e32d069a57c597f53569dbee52cec890507
treefbd707285add12f8ffe2bc7defb4e9078179181d
parentc3c7b3173dbf1dc1d9bba886d7a7b1f84e4e4176
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