Motivated by coronal mass ejection studies, we construct general relativistic models of a magnetar magnetosphere endowed with strong magnetic fields. The equilibrium states of the stationary, axisymmetric magnetic fields in the magnetar magnetosphere are obtained as solutions of the GradShafranov equation in a Schwarzschild spacetime. To understand the magnetic energy buildup in the magnetar magnetosphere, a generalized magnetic virial theorem in the Schwarzschild metric is newly derived. We carefully address the question whether the magnetar magnetospheric magnetic field can build up sufficient magnetic energy to account for the work required to open up the magnetic field during magnetar giant flares. We point out the importance of the AlySturrock constraint, which has been widely studied in solar corona mass ejections, as a reference state in understanding magnetar energy storage processes. We examine how the magnetic field can possess enough energy to overcome the AlySturrock energy constraint and open up. In particular, general relativistic (GR) effects on the AlySturrock energy constraint in the Schwarzschild spacetime are carefully investigated. It is found that, for magnetar outbursts, the AlySturrock constraint is more stringent, i.e., the AlySturrock energy threshold is enhanced due to the GR effects. In addition, neutron stars with greater mass have a higher AlySturrock energy threshold and are more difficult to erupt. This indicates that magnetars are probably not neutron stars with extreme mass. For a typical neutron star with mass of 12 M _{☉}, we further explore the crossfield current effects, caused by the mass loading, on the possibility of stored magnetic field energy exceeding the AlySturrock threshold.
