commit | 9162bc025256d638369c77c845b8a5ed66eeff5a | [log] [tgz] |
---|---|---|
author | Edward Z. Yang <ezyang@fb.com> | Wed Sep 07 15:43:58 2022 -0400 |
committer | PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> | Thu Sep 08 01:03:00 2022 +0000 |
tree | ee36c1678f01b91f8efa8004a66678e3d6a828f0 | |
parent | 29672b2136fc80537edf4632b2cf40f48efe0ab8 [diff] |
Convert NoopPyInterpreterVTable into a Meyer singleton (#84656) Signed-off-by: Edward Z. Yang <ezyang@fb.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/84656 Approved by: https://github.com/wconstab
diff --git a/c10/core/impl/PyInterpreter.cpp b/c10/core/impl/PyInterpreter.cpp index a00c872..d8c7784 100644 --- a/c10/core/impl/PyInterpreter.cpp +++ b/c10/core/impl/PyInterpreter.cpp
@@ -67,9 +67,8 @@ }; void PyInterpreter::disarm() noexcept { - // Intentionally leaked - static PyInterpreterVTable* noop_vtable = new NoopPyInterpreterVTable(); - vtable_ = noop_vtable; + static NoopPyInterpreterVTable noop_vtable; + vtable_ = &noop_vtable; } } // namespace impl