Dispose products you don’t need anymore, and call the Garbage Collector by System.gc()
This cleans at least the Java side.
But it also depends on how you are using the data on the Python side.
As a general comment - I don’t know your code or what you are doing Python - it helps to reduce memory if you process the data in chunks and not the whole scene at once.