Transmission electron microscopy studies were applied to study GaN crystals doped with Mg. Both bulk GaN:Mg crystals grown by a high pressure and high temperature process and epitaxial layers grown ...by metal-organic chemical-vapor deposition (MOCVD) have been studied. A structural dependence on the growth polarity was observed in bulk crystals. Spontaneous ordering (formation of polytypoids) was observed for growth in the N to Ga polar direction (N polarity). On the opposite site of the crystal (growth in the Ga to N polar direction) Mg-rich pyramidal defects with base on the basal planes and with walls inclined about 45/spl deg/ to these planes, empty inside (pinholes) were observed. A high concentration of these pyramidal defects was also observed in the MOCVD grown crystals. For samples grown with Mg delta doping planar defects were also observed especially at the early stages of growth followed by formation of pyramidal defects, TEM and X-ray studies of In/sub x/Ga/sub 1-x/N crystals for the range of 28-45% nominal in concentration showed formation of two sub-layers: strained and relaxed, with a much lower In concentration in the strained layer. Layers with the highest In concentration were fully relaxed.