The id to type map stores unique pointers of types. These pointers may be used in other types. If the TypeManager removes a mapping for a particular id, the memory for the type is free'd. Instead the type manager should have a pool of allocated types and store regular pointer in the id to type map.