0

I am writing a server App that consumes a lot of memory, I have an issue where python is not returning the memory back to the OS so over time my application consumes more and more memory. I have done lots of tests and have confirmed that the large objects I am using are being properly released, so its a python issue.

One work around I have found would be to do the memory heavy work in a separate process and then kill this process once Im finished. But the memory heavy operation happens all the time the clients are connected.

I wrote the server using a Twisted Perspective Broker to handle the client/server communications and it works fine. What I am trying to achieve is connecting to the server and once some authentication has taken place spawn a process which is alive all the time that user is connected and then to stop that process when the user disconnects, this should solve my memory issues.

I am trying to work out the best way to handle this process. I can use reactor.spawnprocess to run another process on connection, but I am unsure the best way to proxy the PB calls to this sub process,

Any advice you can offer would be excellent.

2
  • possible duplicate of Python Memory usage doesnt drop Jan 9, 2014 at 15:46
  • I don't think it is a duplicate, The reason for the memory not dropping was answered in the other question. The way to get it to drop is to kill the process and restart, or to have a sub process, that is what I am asking in this question, how to get PB to create a sub process
    – Deano123
    Jan 9, 2014 at 16:18

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.