Memory Leaks can be tricky

Just wanted to say I’m combing the Forum threads and have seen several contributors suggestions to reveal memory leaks. I have some excellent direction to investigate now. Thank you contributors. I have a Web App that opens a new file on the local server…and connects to a remote file using the MBS Curl Plugin. I set a bunch of “curl” properties and create a binary stream…and tell it to execute the Curl command…which seems to work fine… it streams the data from the remote server…and provides me with progress updates 10%, 17%, 35%, etc. When the transfer is complete… I close the Binary stream. I’ve noted that during operation…it seems the memory tied to my Xojo app correlates to the size of the file being transferred. I’m not sure that memory is ever “released” when the session closes either.

Thus my Web App sucks down more and more memory until the App “pops” (aborts). Not from a lack of memory on the server… probably something to due with the 32-bit build and some corresponding app memory limit.

To be fair, even if you have a 64-bit app most hosting servers have <= 4GB of RAM. Even with more RAM, you’d only be postponing the issue.

The thing that people often do incorrectly with web apps is to keep hard references to sessions or pages from items that are inside that item. Like making a property on a WebContainer of currentSession as Session and then not setting it to Nil when you’re done with it. When a session is done, all the framework can do is release the references it knows about. If there are others lying around that we’re created by the user, the Session stays in memory, but can no longer be reached and you’ve got a leak.