Skip to content

Commit

Permalink
fix(memory): apply gc fix from moddable
Browse files Browse the repository at this point in the history
  • Loading branch information
mhofman committed Dec 7, 2022
1 parent 547c16c commit 4b31262
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions xs/sources/xsMemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,15 @@ void fxGrowSlots(txMachine* the, txSize theCount)
while (theCount--) {
txSlot* next = aSlot + 1;
aSlot->next = next;
aSlot->flag = XS_NO_FLAG;
aSlot->kind = XS_UNDEFINED_KIND;
#if mxPoisonSlots
ASAN_POISON_MEMORY_REGION(&aSlot->value, sizeof(aSlot->value));
#endif
aSlot = next;
}
aSlot->next = the->freeHeap;
aSlot->flag = XS_NO_FLAG;
aSlot->kind = XS_UNDEFINED_KIND;
#if mxPoisonSlots
ASAN_POISON_MEMORY_REGION(&aSlot->value, sizeof(aSlot->value));
Expand Down Expand Up @@ -839,6 +841,8 @@ void fxMarkReference(txMachine* the, txSlot* theSlot)
fxCheckCStack(the);
if ((aSlot = theSlot->value.array.address)) {
txIndex aLength = (((txChunk*)(((txByte*)aSlot) - sizeof(txChunk)))->size) / sizeof(txSlot);
if (aLength > theSlot->value.array.length)
aLength = theSlot->value.array.length;
while (aLength) {
fxMarkReference(the, aSlot);
aSlot++;
Expand Down

0 comments on commit 4b31262

Please sign in to comment.