Skip to content

Commit

Permalink
Properly reset infoblock on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
nineonine committed Oct 2, 2023
1 parent 1aea6ee commit 4f8c7ff
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frontend/src/Visualization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const Visualization: React.FC = () => {
const resetViz = () => {
setIsRunning(false);
setIsHalt(false);
setInfoBlock(resetInfoBlock(infoBlock, memory.length))
setMemory(new Array(0).fill({ status: CellStatus.Free }));
setEventLogs([[SUGGEST_INIT_LOG_ENTRY, undefined]]);
clearHighlightedCells();
Expand Down Expand Up @@ -160,3 +161,13 @@ const Visualization: React.FC = () => {
}

export default Visualization;

const resetInfoBlock = (infoBlock: InfoBlockData, heapSize: number): InfoBlockData => {
return {
gc_type: infoBlock.gc_type,
alignment: infoBlock.alignment,
heap_size: infoBlock.heap_size,
allocd_objects: 0,
free_memory: heapSize,
}
}

0 comments on commit 4f8c7ff

Please sign in to comment.