MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxFree

Function fxFree

xs/sources/xsMemory.c:526–605  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

524}
525
526void fxFree(txMachine* the)
527{
528 txSlot* aHeap;
529
530#if mxAliasInstance
531 if (the->aliasArray)
532 c_free_uint32(the->aliasArray);
533 the->aliasArray = C_NULL;
534#endif
535
536 fxFreeStringInfoCache(the);
537
538 if (the->symbolTable)
539 c_free_uint32(the->symbolTable);
540 the->symbolTable = C_NULL;
541 if (the->nameTable)
542 c_free_uint32(the->nameTable);
543 the->nameTable = C_NULL;
544 if (the->keyArray)
545 c_free_uint32(the->keyArray);
546 the->keyArray = C_NULL;
547
548 while (the->firstHeap) {
549 aHeap = the->firstHeap;
550 the->firstHeap = aHeap->next;
551 fxFreeSlots(the, aHeap);
552 }
553 the->firstHeap = C_NULL;
554
555 if (the->stackBottom)
556 fxFreeSlots(the, the->stackBottom);
557 the->stackBottom = C_NULL;
558 the->stackTop = C_NULL;
559 the->stackIntrinsics = C_NULL;
560 the->stackPrototypes = C_NULL;
561 the->stack = C_NULL;
562
563#if mxNoChunks
564 {
565 txChunk** address;
566 txChunk* chunk;
567 address = (txChunk**)&(the->firstBlock);
568 while ((chunk = *address)) {
569 *address = (txChunk*)(chunk->temporary);
570 c_free(chunk);
571 }
572 }
573#else
574 {
575 txBlock* aBlock;
576 while (the->firstBlock) {
577 aBlock = the->firstBlock;
578 the->firstBlock = aBlock->nextBlock;
579 fxFreeChunks(the, aBlock);
580 }
581 the->firstBlock = C_NULL;
582 }
583#endif

Callers 4

fxCreateMachineFunction · 0.85
fxDeleteMachineFunction · 0.85
fxCloneMachineFunction · 0.85
fxReadSnapshotFunction · 0.85

Calls 4

fxFreeStringInfoCacheFunction · 0.85
stopTimeFunction · 0.85
fxFreeSlotsFunction · 0.70
fxFreeChunksFunction · 0.70

Tested by

no test coverage detected