zxybazh commented on a change in pull request #10874:
URL: https://github.com/apache/tvm/pull/10874#discussion_r840925066
##########
File path: python/tvm/exec/popen_worker.py
##########
@@ -40,22 +40,34 @@ def main():
if len(sys.argv) != 3:
print("Usage: <read_fd> <write_fd>")
return
- if sys.platform == "win32":
- # pylint: disable=import-outside-toplevel
- import msvcrt
-
- reader = os.fdopen(msvcrt.open_osfhandle(int(sys.argv[1]),
os.O_BINARY), "rb")
- writer = os.fdopen(msvcrt.open_osfhandle(int(sys.argv[2]),
os.O_BINARY), "wb")
- else:
- reader = os.fdopen(int(sys.argv[1]), "rb")
- writer = os.fdopen(int(sys.argv[2]), "wb")
logging.basicConfig(level=logging.INFO)
lock = threading.Lock()
+ def get_reader():
Review comment:
Hi TQ, it does not acutally help that we put `fdopen` into a
subfunction. The cause of the memory leak is acutally reusing the same `reader`
and `writer`. The change is acutally to create new `reader` and `writer`
everytime instead of reusing the same ones to avoid leak.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]