Class ResourceLimits

java.lang.Object
opennlp.tools.util.ResourceLimits

public final class ResourceLimits extends Object
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 Details

    • MAX_ENTRIES_PROPERTY

      public static final String MAX_ENTRIES_PROPERTY
      System property for overriding MAX_ENTRIES. Set at JVM startup, e.g. -DOPENNLP_MAX_ENTRIES=5000000. Falls back to 10_000_000 if absent or invalid.
      See Also:
    • MAX_ENTRIES

      public static final int MAX_ENTRIES
      Upper bound on count fields and resource sizes that drive allocations (matrix dimensions, lexicon entries, model outcome counts, and similar). Configurable via MAX_ENTRIES_PROPERTY.
    • MAX_MATRIX_CELLS_PROPERTY

      public static final String MAX_MATRIX_CELLS_PROPERTY
      System property for overriding MAX_MATRIX_CELLS. Set at JVM startup, e.g. -Dopennlp.max.matrix.cells=20000000. Falls back to 134_217_728 if absent or invalid.
      See Also:
    • MAX_MATRIX_CELLS

      public static final int MAX_MATRIX_CELLS
      Upper bound on the cell count of a two-dimensional cost table, whose entries are far smaller than the record-sized entries MAX_ENTRIES bounds. 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, above MAX_ENTRIES) while still refusing the roughly 4 GiB allocation a crafted 46340 46340 header would force. Configurable via MAX_MATRIX_CELLS_PROPERTY.