// file: mm_grow_0.cc
//
 
// isip include files
//
#include "memory_manager.h"
#include "memory_manager_constants.h"
 
// method: grow_node_cc
//
// arguments: none
//
// return: a logical_1 indicating success
//
// this method grows the number of empty nodes by the node grow size
//
logical_1 Memory_manager::grow_node_cc() {

  // create new empty nodes
  //
  Link_node** nodes = new Link_node*[node_grow_size_d];

  // allocate and insert the nodes in a list
  //
  for (int_4 i = 0; i < node_grow_size_d; i++) {

    nodes[i] = new Link_node();
    if ((i == (int_4)0) && (node_count_d == (int_4)0)) {
      node_list_d = nodes[i];
    }
    else {
      node_list_d->insert_cc(nodes[i]);
    }
  }

  // update the count of free nodes
  //
  node_count_d += node_grow_size_d;
  num_node_d += node_grow_size_d;

  // free pointer memory since the objects will be deleted seperately
  //
  delete [] nodes;
  
  // exit gracefully
  //
  return ISIP_TRUE;
}
