Skip to content

Commit 2696367

Browse files
committed
upip: Add explicit gc.collect() calls for low-heap ports.
1 parent d1bc491 commit 2696367

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

upip/upip.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import sys
2+
import gc
23
import uos as os
34
import uerrno as errno
45
import ujson as json
56
import uzlib
67
import upip_utarfile as tarfile
8+
gc.collect()
79

810

911
debug = False
@@ -148,6 +150,8 @@ def install_pkg(pkg_spec, install_path):
148150

149151
latest_ver = data["info"]["version"]
150152
packages = data["releases"][latest_ver]
153+
del data
154+
gc.collect()
151155
assert len(packages) == 1
152156
package_url = packages[0]["url"]
153157
print("Installing %s %s from %s" % (pkg_spec, latest_ver, package_url))
@@ -157,6 +161,9 @@ def install_pkg(pkg_spec, install_path):
157161
f3 = tarfile.TarFile(fileobj=f2)
158162
meta = install_tar(f3, install_path)
159163
f1.close()
164+
del f3
165+
del f2
166+
gc.collect()
160167
return meta
161168

162169
def install(to_install, install_path=None):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy