Reputation: 1
I had a problem with an application in coldfusion 9 and application.cfc. In the onRequestStart method there were variables with application scope example:
<cffunction name = "onRequestStart">
<cfset application.URL_Images =
'<img src = "http: // # server_name #: # server_port # / aseng / images / logo1.jpg">'>
</cffunction>
As I have many people accessing the application, the server gave a timeout and I saw in the Monitor that the scope application was consuming a lot of memory.
The question is, do application scope variables in Application.cfc consume more memory than in Application.cfm?
In Application.cfm the server didn't happen to crash.
I have variables that need to be validated for each request because they receive different values depending on the type of access. We have remote access and local access which are separate ports.
How can I set these variables without consuming memory on the server? To work around the problem, I went back to Application.cfm until I was sure that Application.cfc was created correctly.
Thanks
Upvotes: 0
Views: 203
Reputation: 14859
Do application scope variables in Application.cfc consume more memory than in Application.cfm
Answer: No. Not at all.
You may be setting things into the application
scope that shouldn't be. That code says that for all users, for each request, redefine an application level variable. Seems like that value should be a request
level variable as it changes based on the user and their settings.
application.URL_Images
.application.URL_Images
.application.URL_Images
, which has now been changed. It may just be the case that your application load is reaching current resource limits. Odd that it's only acting oddly with the cfc
and not the cfm
.
Finally, review how you structured your Applicaiton.cfc
. There may be something else in there overloading the application
scope based on the CFC
function triggers that is running under a different condition in the CFM
. I would explore more of what else is in the application scope and ensure what is there, when it is loaded and if it needs to be "cached" there.
Upvotes: 1