When dealing with nested ORM relations, using cfdump or writeDump can rapidly result in java.lang.OutOfMemoryError errors because CF attempts to resolve relations in nested objects and dump too many objects.
This can be avoided with the top attribute, for example: <cfdump var=#SomeObject# top=3 />
It's a pain to remember to write this all the time - is there any way to configure CF to not go down too many levels when dealing with ORM objects?
There doesn't appear to be any administrator settings for this. (issue raised)
An imperfect solution is to create a wrapper for the cfdump tag by renaming
{cfusion}/wwwroot/WEB-INF/cftags/dump.cfmto (for example)origdump.cfmthen creating a newdump.cfmfile containing:Fortunately, the writeDump function will call this wrapper (so it works for both tag and function).
Unfortunately the wrapper is not called recursively - if the ORM object is in a struct or array then the original problem still manifests itself - it may be possible to pre-scan complex variables to determine if there are relationships inside and set an appropriate top value, but only a limited solution could be achieved with this (i.e. it would affect neighbouring structs/arrays).