extract create destroy gc pattern for different types