







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








c a e d b
c a e d b
c a e d b
c a e d e
Advantages Of Garbage Collection
Advantages Of Garbage Collection
Storage Pool Organization When All Nodes Have Same Size
a b c d e
null
Simulated-Pointer Memory Management
/** memory management for simulated pointer classes / package dataStructures; import utilities.; public class SimulatedSpace { // data members private int firstNode; SimulatedNode [] node; // package visible
// constructor and other methods come here }
public SimulatedSpace1(int numberOfNodes) { node = new SimulatedNode [numberOfNodes];
// create nodes and link into a chain for (int i = 0; i < numberOfNodes - 1; i++) node[i] = new SimulatedNode(i + 1);
// last node of array and chain node[numberOfNodes - 1] = new SimulatedNode(-1); // firstNode has the default initial value 0 }
public int allocateNode(Object element, int next) {// Allocate a free node and set its fields. if (firstNode == -1) { // double number of nodes, code omitted }
int i = firstNode; // allocate first node firstNode = node[i].next; // firstNode points to next free node node[i].element = element; node[i].next = next; return i; }