Class ResourceLimits
java.lang.Object
opennlp.tools.util.ResourceLimits
Shared upper bounds for counts read from user-supplied resources, so a crafted
file cannot force an outsized allocation before validation completes.
- Since:
- 3.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intUpper bound on count fields and resource sizes that drive allocations (matrix dimensions, lexicon entries, model outcome counts, and similar).static final StringSystem property for overridingMAX_ENTRIES.static final intUpper bound on the cell count of a two-dimensional cost table, whose entries are far smaller than the record-sized entriesMAX_ENTRIESbounds.static final StringSystem property for overridingMAX_MATRIX_CELLS. -
Method Summary
-
Field Details
-
MAX_ENTRIES_PROPERTY
System property for overridingMAX_ENTRIES. Set at JVM startup, e.g.-DOPENNLP_MAX_ENTRIES=5000000. Falls back to10_000_000if absent or invalid.- See Also:
-
MAX_ENTRIES
public static final int MAX_ENTRIESUpper bound on count fields and resource sizes that drive allocations (matrix dimensions, lexicon entries, model outcome counts, and similar). Configurable viaMAX_ENTRIES_PROPERTY. -
MAX_MATRIX_CELLS_PROPERTY
System property for overridingMAX_MATRIX_CELLS. Set at JVM startup, e.g.-Dopennlp.max.matrix.cells=20000000. Falls back to134_217_728if absent or invalid.- See Also:
-
MAX_MATRIX_CELLS
public static final int MAX_MATRIX_CELLSUpper bound on the cell count of a two-dimensional cost table, whose entries are far smaller than the record-sized entriesMAX_ENTRIESbounds. The default of 2^27 cells caps a 16-bit cost matrix at 256 MiB, which admits every published MeCab-format distribution (mecab-ko-dic 2.1.1 alone declares 3822 x 2693, aboveMAX_ENTRIES) while still refusing the roughly 4 GiB allocation a crafted46340 46340header would force. Configurable viaMAX_MATRIX_CELLS_PROPERTY.
-