A gray image uses - depending on the color depth - 1 or 2 Bytes for every pixel. 1 Byte per pixel results in 8 Bit depths, 2 Bytes in 16 Bit. Therefore a gray image with 8-Bit-depth offers 256 shades of gray and every pixel can have any of these shades.
A gray image (8 Bit) with a size of 1024 x 1024 pixels occupies 1024 * 1024 Byte- 1 MByte - memory.