All instances of a particular CFCs share a single object for each of their methods. So, a CFC is essintially an object with references to *singleton* method objects. Very efficient use of memory.
On 7/24/05, Barney Boisvert <[EMAIL PROTECTED]> wrote: > > CFCs are definitely heavier than POJOs, however, much of that's at the > class level, not the instance level. If you go look at the generated > ..class files, you'll see that a CFC generates a class for the CFC > itself, and then another class for each function. So if a given CFC > will always require N+1 Java classes, where N is the number of methods > on the CFC. > > I'm not sure if CFCs share method instances or not. If they do, then > there should be little per-instance overhead, as a CFC instance is > little more than a couple nested structures. If not, then you're > going to be lugging around not only the nested structures, but also > instances of each function per CFC instance, which could lead to > significant memory usage. > > However, all that being said, it's an implementation detail that > shouldn't really be of concern to developers for two main reasons. > First, RAM is so damn cheap, and second, if you really care that much, > you should be using POJOs. Java is SO simple to integrate into CF, > there's really no excuse to not use it when you have a situation that > warrants it. If you find your CFC implementation to be to much of a > resource hog, add more memory to alleviate the problem (and keep the > CF's hallmark ease-of-use), or switch the objects to POJOs (to get the > tighter Java environment), but leave the business logic in CFCs. > > If you wanted to go for broke testing, it should be relatively > straightforward to create a test environment for checking the size of > a CFC instance. You just need a really good memory utilization > checker for your system (not measured in percent, or MB, but bytes). > Initialize all your code, make sure everything's been instantiated and > executed. Check memory, create exactly one persistant instance, and > check memory again. If you've done a proper job making sure nothing > but that instance was created (or have ensured everything else was > garbage collected), you'll know how big it is. > > cheers, > barneyb > > On 7/24/05, Dov Katz <[EMAIL PROTECTED]> wrote: > > I have a cache similar to the cf_scopecache, though my objects can be > stored to file, memory as text, memory as a query, or memory as a cfc. > > > > I have a gallery cfc which holds an array of photo cfc instances. Real > simple, an id, file path, folder path, and friendly names for both object > types. > > > > They really helped performance but they seem to hog memory. How much > atypical (not your avg java object) overhead do cfc's add to traditional > java objects, if any? Just trying to make sure I am making the correct > assumptions about CFC's .... > > > > Thanks > > -Dov > > > -- > Barney Boisvert > [EMAIL PROTECTED] > 360.319.6145 > http://www.barneyb.com/ > > Got Gmail? I have 50 invites. > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:212703 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

