Skip to content
Discussion options

You must be logged in to vote

Digging further and extending my test, I see that over time memory does get freed and there is no memory leak here (It levels out after just a few requests as can also be seen here #1893)
The test below requests a 100kb file, 300 times and then measuring the amount of memory used.
After 300 requests, there is an overall memory increase of only ~5mb in my tests.

Code below:

import httpx
import asyncio
from memory_profiler import profile
import gc

RUNS = 150

def getCurrentMemoryUsage() -> int:    
    """Return memory usage in kB
    """
    with open('/proc/self/status') as f:
        memusage = f.read().split('VmRSS:')[1].split('\n')[0][:-3]

    return int(memusage.strip())

#@profile(…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lovelydinosaur
Comment options

Answer selected by splotsh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants