mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 09:37:37 +00:00
add memory leak detect script for certificate generation, refs #4368
This commit is contained in:
parent
7d7c2908b2
commit
74aeb3ae4c
21
test/helper_tools/memoryleak2.py
Normal file
21
test/helper_tools/memoryleak2.py
Normal file
@ -0,0 +1,21 @@
|
||||
import secrets
|
||||
from pathlib import Path
|
||||
|
||||
import objgraph
|
||||
|
||||
from mitmproxy import certs
|
||||
|
||||
if __name__ == "__main__":
|
||||
store = certs.CertStore.from_store(path=Path("~/.mitmproxy/").expanduser(), basename="mitmproxy", key_size=2048)
|
||||
store.STORE_CAP = 5
|
||||
|
||||
for _ in range(5):
|
||||
store.get_cert(commonname=secrets.token_hex(16).encode(), sans=[], organization=None)
|
||||
|
||||
objgraph.show_growth()
|
||||
|
||||
for _ in range(20):
|
||||
store.get_cert(commonname=secrets.token_hex(16).encode(), sans=[], organization=None)
|
||||
|
||||
print("====")
|
||||
objgraph.show_growth()
|
Loading…
Reference in New Issue
Block a user