SizeOf()
This function is experimental, do not use in a production environment. This function returns the size in bytes of a given object.
SizeOf( obj=object, complex=boolean );
Returns: any
| Argument | Description |
|---|---|
|
obj
object,
required
|
edit
object to get size for |
|
complex
boolean,
optional
|
edit
if set to false, the size is returned, if set to true a struct containing the element count and the size is returned |
Examples
edit// Measuring size of application variables and dumping the content to screen
qSize = queryNew("key,size");
for (key in application) {
qSize.addRow();
qSize.setCell("key", key, qSize.recordCount);
qSize.setCell("size", sizeOf(application[key]), qSize.recordCount);
}
qSize.sort("size", "desc");
dump(var=qSize, label="Size of all keys in application scope");
See also
- Debugging
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)