Pass max trie structure size to on memory Ver4DictBuffers.
Bug: 14166482 Bug: 14161647 Change-Id: I3b0dd192d7a81c3809f1873bb66ef8fe637f8af0
This commit is contained in:
parent
1ee443d848
commit
7b43d987fa
4 changed files with 9 additions and 8 deletions
|
@ -130,11 +130,10 @@ Ver4DictBuffers::Ver4DictBuffers(const char *const dictPath,
|
|||
mShortcutDictContent(dictPath, isUpdatable),
|
||||
mIsUpdatable(isUpdatable) {}
|
||||
|
||||
Ver4DictBuffers::Ver4DictBuffers(const HeaderPolicy *const headerPolicy)
|
||||
Ver4DictBuffers::Ver4DictBuffers(const HeaderPolicy *const headerPolicy, const int maxTrieSize)
|
||||
: mHeaderBuffer(nullptr), mDictBuffer(nullptr), mHeaderPolicy(),
|
||||
mExpandableHeaderBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE),
|
||||
mExpandableTrieBuffer(Ver4DictConstants::MAX_DICTIONARY_SIZE),
|
||||
mTerminalPositionLookupTable(),
|
||||
mExpandableTrieBuffer(maxTrieSize), mTerminalPositionLookupTable(),
|
||||
mProbabilityDictContent(headerPolicy->hasHistoricalInfoOfWords()),
|
||||
mBigramDictContent(headerPolicy->hasHistoricalInfoOfWords()), mShortcutDictContent(),
|
||||
mIsUpdatable(true) {}
|
||||
|
|
|
@ -39,8 +39,8 @@ class Ver4DictBuffers {
|
|||
MmappedBuffer::MmappedBufferPtr headerBuffer);
|
||||
|
||||
static AK_FORCE_INLINE Ver4DictBuffersPtr createVer4DictBuffers(
|
||||
const HeaderPolicy *const headerPolicy) {
|
||||
return Ver4DictBuffersPtr(new Ver4DictBuffers(headerPolicy));
|
||||
const HeaderPolicy *const headerPolicy, const int maxTrieSize) {
|
||||
return Ver4DictBuffersPtr(new Ver4DictBuffers(headerPolicy, maxTrieSize));
|
||||
}
|
||||
|
||||
AK_FORCE_INLINE bool isValid() const {
|
||||
|
@ -122,7 +122,7 @@ class Ver4DictBuffers {
|
|||
Ver4DictBuffers(const char *const dictDirPath,
|
||||
const MmappedBuffer::MmappedBufferPtr headerBuffer, const bool isUpdatable);
|
||||
|
||||
Ver4DictBuffers(const HeaderPolicy *const headerPolicy);
|
||||
Ver4DictBuffers(const HeaderPolicy *const headerPolicy, const int maxTrieSize);
|
||||
|
||||
const MmappedBuffer::MmappedBufferPtr mHeaderBuffer;
|
||||
const MmappedBuffer::MmappedBufferPtr mDictBuffer;
|
||||
|
|
|
@ -55,7 +55,8 @@ bool Ver4PatriciaTrieWritingHelper::writeToDictFileWithGC(const int rootPtNodeAr
|
|||
const char *const dictDirPath) {
|
||||
const HeaderPolicy *const headerPolicy = mBuffers->getHeaderPolicy();
|
||||
Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers(
|
||||
Ver4DictBuffers::createVer4DictBuffers(headerPolicy));
|
||||
Ver4DictBuffers::createVer4DictBuffers(headerPolicy,
|
||||
Ver4DictConstants::MAX_DICTIONARY_SIZE));
|
||||
int unigramCount = 0;
|
||||
int bigramCount = 0;
|
||||
if (!runGC(rootPtNodeArrayPos, headerPolicy, dictBuffers.get(), &unigramCount, &bigramCount)) {
|
||||
|
|
|
@ -49,7 +49,8 @@ const char *const DictFileWritingUtils::TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE =
|
|||
const DictionaryHeaderStructurePolicy::AttributeMap *const attributeMap) {
|
||||
HeaderPolicy headerPolicy(FormatUtils::VERSION_4, localeAsCodePointVector, attributeMap);
|
||||
Ver4DictBuffers::Ver4DictBuffersPtr dictBuffers(
|
||||
Ver4DictBuffers::createVer4DictBuffers(&headerPolicy));
|
||||
Ver4DictBuffers::createVer4DictBuffers(&headerPolicy,
|
||||
Ver4DictConstants::MAX_DICT_EXTENDED_REGION_SIZE));
|
||||
headerPolicy.fillInAndWriteHeaderToBuffer(true /* updatesLastDecayedTime */,
|
||||
0 /* unigramCount */, 0 /* bigramCount */,
|
||||
0 /* extendedRegionSize */, dictBuffers->getWritableHeaderBuffer());
|
||||
|
|
Loading…
Reference in a new issue