Air infiltration and exfiltration within a home contributes to almost 99% of moisture migration. Restricting air movement stops moisture accumulation so that the possibility of mold growth is less likely. Combined with a properly sized HVAC system, spray foam insulation helps control the indoor humidity levels to minimize moisture and condensation. Reducing moisture and controlling humidity can also add years to the life expectancy of a home, plus contribute to a healthier indoor environment. Finally, it also deters pests, making it difficult for them to nest.
Low-density foam is applied as low or high-pressure, two-component polyurethane spray foam. Low-density spray foam can be applied on walls, in unvented attics, to ducts and ceilings, and in vented attics and crawl spaces. It is known as an air barrier, but permeable to vapor and moisture. It is often used to fill cavities in walls during construction.
Closed-cell (aka two-pound foam) is denser than open-cell at about 2 pounds per cubic foot. Its R-Value is between 6-6.5 per inch. As a result, this kind of foam is much more expensive than its counterpart. The reason closed-cell doesn't need a vapor retarder is because it already has one. It's permeance is 0.8 perm, which means it can handle cold climates without the use of an additional board or drywall. Closed-cell uses hydroflurocarbons (HFCs) as part of its makeup. However, this material has been known to have a high global warming effect. If you want a green insulation solution, this is not the material to use. A way to avoid this and still use closed-cell is by installing it alongside fiberglass batts.
There are two main types of spray foam to consider: open-cell and closed-cell. Open-cell spray foam has a lower R-value per inch and because of this, typically a lower price tag. The soft, low-density material is used for interior applications. Its high permeability allows for moisture to pass through, which contributes to bi-directional drying of the assembly, but it may not be ideal for all applications or climates. 

R-value is the term given to thermal resistance to heat flow. The higher the R-value of an insulation product, the more effective the insulation properties. Spray polyurethane foam comes in a range of densities and cel structure. Low density foams are referred to as Open Cel SPF while higher density foams are referred to as Closed Cel foam. 1.8-2 pound polyurethane foam has the highest R-value of readily available spray foam insulation used in homes and buildings.[4]

Roof Spray Foam Insulation