Juan Souto Heegaard genus and distances in the curve complex. Generalizing a theorem of Lackenby we compute the Heegaard genus of those 3--manifolds which are obtained gluing two manifolds with boundary whenever the gluing map is complicated enough.