Skip to content

Commit

Permalink
chore(patches): fix luajit segment release check in internal memory a…
Browse files Browse the repository at this point in the history
…llocator

### Summary

See: LuaJIT/LuaJIT@9b5e837
Signed-off-by: Aapo Talvensaari <[email protected]>
  • Loading branch information
bungle committed Jun 17, 2024
1 parent 3c0aa60 commit 32c0316
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c b/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c
index 9adaa0e5bd..0c0c0c4f4c 100644
--- a/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c
+++ b/bundle/LuaJIT-2.1-20231117/src/lj_alloc.c
@@ -1057,7 +1057,7 @@ static size_t release_unused_segments(mstate m)
mchunkptr p = align_as_chunk(base);
size_t psize = chunksize(p);
/* Can unmap if first chunk holds entire segment and not pinned */
- if (!cinuse(p) && (char *)p + psize >= base + size - TOP_FOOT_SIZE) {
+ if (!cinuse(p) && (char *)p + psize == (char *)mem2chunk(sp)) {
tchunkptr tp = (tchunkptr)p;
if (p == m->dv) {
m->dv = 0;

0 comments on commit 32c0316

Please sign in to comment.