//****************************************************
        // Method: deallocatePartition
        //
        // Purpose: Deallocates a partition in the given array
        //          of partitions at the specified address.
        //          Returns 0 if successful, or -1 on error.
        //****************************************************
        protected static int deallocatePartition(int atAddress, Partition[] inPartitions)
        {
            Partition partition = MyFixedPartitionMemoryManager.findPartition(inPartitions, atAddress);

            if (partition != null)
            {
                return partition.deallocate();
            }

            return -1;
        }
        //****************************************************
        // Method: findPartition
        //
        // Purpose: Finds a partition that contains the given memory address
        //          in the specified array of Partitions. Returns a Partition
        //          object that contains the memory address, and null if no parition
        //          is found or if there is an error.
        //****************************************************
        protected static Partition findPartition(Partition[] inPartitions, int byAddress)
        {
            foreach (Partition partition in inPartitions)
            {
                if (partition.containsAddress(byAddress))
                {
                    return partition;
                }
            }

            return null;
        }
        //****************************************************
        // Method: addressOfNextAvailablePartition
        //
        // Purpose: Gets the address of the next available partition
        //          in an array of partitions that can hold the specified size.
        //          Returns the absolute address of the beginning of the partition,
        //          or -1 on error.
        //****************************************************
        protected static int addressOfNextAvailablePartition(int forSize, Partition[] inPartitions)
        {
            foreach (Partition partition in inPartitions)
            {
                if (partition.canAllocate(forSize))
                {
                    return partition.AbsoluteAddress;
                }
            }

            return -1;
        }