int alloc(int len) {
    if (hp+len+1 > size) {     // Check for space in the heap.
       garbageCollect();       // Invoke garbage collector.
       if (hp+len+1 > size) {  // And then retest for space in heap.
          fatal("Out of memory!");
       }
    }
    int result = hp-size;
    for (heap[hp++]=len; len>0; len--) {
      heap[hp++] = 0;
    }
    return result;
  }