Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Memory use of a script
#6
If your function is dealing with files, it should be closing them explicitly. A with-block (or "context manager") is generally the normal way to do that.

Even if you weren't doing that, your file objects would (eventually) be closed by the garbage collector, with or without hitting the whole module, since the files are kept on the stack which is cleaned up after the function call completes.
Reply


Messages In This Thread
Memory use of a script - by ebolisa - Nov-02-2018, 01:23 PM
RE: Memory use of a script - by micseydel - Nov-02-2018, 03:51 PM
RE: Memory use of a script - by ebolisa - Nov-02-2018, 04:00 PM
RE: Memory use of a script - by micseydel - Nov-02-2018, 06:36 PM
RE: Memory use of a script - by ebolisa - Nov-02-2018, 06:46 PM
RE: Memory use of a script - by micseydel - Nov-02-2018, 07:01 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020