package edu.lsu.cct.MCSMPGC; import java.util.ArrayList; import java.util.HashMap; public class Memory { public static final int MEM_SIZE = 100; Node[] nodes = new Node[MEM_SIZE]; ArrayList free = new ArrayList(); HashMap allocated = new HashMap(); ArrayList anchors = new ArrayList(); public Memory() { for (int i = 0; i < MEM_SIZE; i++) { nodes[i] = new Node(i,this); free.add(nodes[i]); } } public Node alloc() { if (free.isEmpty()) { System.out.println("Memory exhausted"); return null; } Node n = free.remove(0); allocated.put(n.address, n); return n; } }