add memory deallocation for bitmap and related structures