gc calls the port_end to free memory