The p-cycle is a promising approach for protecting working capacities in optical mesh networks. The most important problem in p-cycle network design is the optimal assignment of the candidate p-cycles. The basic types of p-cycle and the definitions of spare capacity and local-map are introduced. The local-map based expanding algorithms are performed on the cycle to get more efficient p-cycles. We propose a novel heuristic spare capacity allocation algorithm of the p-cycles with the limitation of working capacity. Comparisons are made between the heuristic algorithm of the p-cycles assignment based on spare capacity and our algorithm,the result shows that the performance of our algorithm is better. It can optimize assignment of p-cycles with good efficiency in the optical mesh networks.