The medullary cavity (medulla, innermost part) is the central cavity of bone shafts where red bone marrow and/or yellow bone marrow (adipose tissue) is stored; hence, the medullary cavity is also known as the marrow cavity. Located in the main shaft of a long bone (diaphysis) (consisting mostly of compact bone), the medullary cavity has walls composed of spongy bone (cancellous bone) and is lined with a thin, vascular membrane (endosteum). However, the medullary cavity is the area inside any bone (long, flat, etc.) that holds the bone marrow.

This area is involved in the formation of red blood cells and white blood cells.

More Info: en.wikipedia.org