Skip to content

Commit a088905

Browse files
committed
Refactor classloader inspection thresholds: add memory-based size limit
Renamed INSPECTION_SIZE to INSPECTION_COUNT and repurposed INSPECTION_SIZE to track memory usage in MB. Classloader now flushes based on either class count+ratio or total memory size thresholds.
1 parent 9872a8a commit a088905

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

docs/recipes/environment-variables-system-properties.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,19 +776,26 @@ Defines the maximum number of elements that can be stored in the cfthread scope.
776776

777777
Default character set used to read templates (`.cfm` and `.cfc` files).
778778

779+
#### LUCEE_TEMPLATE_CLASSLOADER_INSPECTION_COUNT
780+
781+
*SysProp:* `-Dlucee.template.classloader.inspection.count`
782+
*EnvVar:* `LUCEE_TEMPLATE_CLASSLOADER_INSPECTION_COUNT`
783+
784+
Defines the threshold number of loaded classes that triggers an inspection to determine if the physical classloader should be flushed. When the total number of loaded classes (including all renamed versions) exceeds this value, Lucee checks the ratio of total classes to unique classes to determine if a flush is needed. The default value is 1000.
785+
779786
#### LUCEE_TEMPLATE_CLASSLOADER_INSPECTION_SIZE
780787

781788
*SysProp:* `-Dlucee.template.classloader.inspection.size`
782789
*EnvVar:* `LUCEE_TEMPLATE_CLASSLOADER_INSPECTION_SIZE`
783790

784-
Defines the threshold number of loaded classes that triggers an inspection to determine if the physical classloader should be flushed. When the total number of loaded classes (including all renamed versions) exceeds this value, Lucee checks the ratio of total classes to unique classes to determine if a flush is needed. The default value is 2000.
791+
Defines the memory size threshold (in megabytes) of loaded classes that triggers a classloader flush. When the total size of all loaded classes (including all renamed versions) exceeds this value, the classloader is flushed to free memory occupied by obsolete class versions. This provides an additional memory-based check alongside the count-based threshold. The default value is 100 MB.
785792

786793
#### LUCEE_TEMPLATE_CLASSLOADER_INSPECTION_RATIO
787794

788795
*SysProp:* `-Dlucee.template.classloader.inspection.ratio`
789796
*EnvVar:* `LUCEE_TEMPLATE_CLASSLOADER_INSPECTION_RATIO`
790797

791-
Defines the ratio threshold that indicates excessive memory usage from obsolete class versions. When templates are updated during development, Lucee loads new versions while old versions remain in memory, creating a "leak". This ratio (total loaded classes / unique loaded classes) measures this accumulation. A ratio of 3 means on average each unique class has 3 versions loaded. When both the inspection size and this ratio threshold are exceeded, the classloader is flushed to free memory occupied by obsolete class versions. The default value is 3.
798+
Defines the ratio threshold that indicates excessive memory usage from obsolete class versions. When templates are updated during development, Lucee loads new versions while old versions remain in memory, creating a "leak". This ratio (total loaded classes / unique loaded classes) measures this accumulation. A ratio of 3 means on average each unique class has 3 versions loaded. When both the inspection count and this ratio threshold are exceeded, the classloader is flushed to free memory occupied by obsolete class versions. The default value is 3.
792799

793800
#### LUCEE_TYPE_CHECKING
794801

0 commit comments

Comments
 (0)