Support for doing this in python was added in PEP-445 (https://www.python.org/dev/peps/pep-0445/) and implementation details can be found here from 2013 (https://bugs.python.org/issue3329). For more info see: https://docs.python.org/3/c-api/memory.html
You can see some commentary on using malloc-trim here too -> https://www.softwareatscale.dev/p/run-python-servers-more-ef...
...long story short: basically, you can already, but it doesn't really make much difference for most workloads.
Or, if your question is, why doesn't python get optimisation love and become fast like the javascript runtimes?
dunno. I guess we just don't have any big FANG companies pouring money on that, because they don't have a use for a faster python. A faster python does not make numpy, tensorflow or pytorch run faster because those are not written in python.
So I guess, there's a lack of value-for-effort in trying to 'fix' the problem of 'pure' python being slow.