17 June 2023
The code like this:
def func():
button = QPushButton()
def _f(s):
print("=========s:", s)
button.clicked.connect(partial(_f, "222"))
#
# for i in range(100):
# func()
def _run():
import gc
gc.collect()
import objgraph
objgraph.show_growth()
ins = objgraph.by_type("QPushButton")
func()
print("======len:", len(ins))
QTimer.singleShot(1000, _run)
_run()
Ссылка
click to show
click to show
sorry,you could find this code at https://github.com/jerryhao2/test/blob/master/test.py