So my application allows for users to upload video, convert it using FFMPEG and then transfer it over to the Flash Media Server. Lately, I've run into an issue.
If ever there is an error when converting video, I automatically generate cfcatch report PDF. This time I came across a "Cannot allocate memory" error. This massively concerns me because I'm about to promote my system out and I can't afford for the scripts to stop running within the first few hours.
Is there a way to clean up the memory issues with ColdFusion? I mean, once the job has been done, can I essentially "reset" the memory that the server was using?
If you understand the potential disaster, I'm sure you'll understand why I've got to find out how to make sure my scripts are executing properly. The physical fix is to restart the server, but I obviously cannot be restarting the server every single time a user uploads a video...
I remember reading that some server versions don't properly dispose of COM objects and the like when a page request is finished. If any of this is being done via a CFC or Java class that's being set to a variable, you can put this in
OnRequestEnd.cfm
:This will get rid of any variables set on the page which are no longer needed. Shouldn't have any negative side effects, and should clear up any memory that might be still lurking in one of the variables set during the processing of that page.
You might also look into using something other than
<cfexecute>
to process the videos. Maybe have a background process that routinely checks a folder for videos and then converts them in the background? ColdFusion isn't necessarily efficient when it comes to batch processing.