mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 05:14:36 +03:00
Fixed memory leak
This commit is contained in:
parent
d232c7bd66
commit
505b5f455d
@ -350,7 +350,6 @@ void BlockHashIndex::CalcHash(size_t current, void* source_void)
|
||||
cmph_config_set_algo(config, CMPH_CHD);
|
||||
|
||||
cmph_t* hash = cmph_new(config);
|
||||
|
||||
PairedPackedArray<> *pv =
|
||||
new PairedPackedArray<>(source->nkeys, m_orderBits, m_fingerPrintBits);
|
||||
|
||||
@ -358,14 +357,15 @@ void BlockHashIndex::CalcHash(size_t current, void* source_void)
|
||||
|
||||
source->rewind(source->data);
|
||||
|
||||
std::string lastKey = ""; //m_landmarks.back();
|
||||
std::string lastKey = "";
|
||||
while(i < source->nkeys)
|
||||
{
|
||||
unsigned keylen;
|
||||
char* key;
|
||||
source->read(source->data, &key, &keylen);
|
||||
std::string temp(key, keylen);
|
||||
|
||||
source->dispose(source->data, key, keylen);
|
||||
|
||||
if(lastKey > temp) {
|
||||
std::cerr << "ERROR: Input file does not appear to be sorted with LC_ALL=C sort" << std::endl;
|
||||
std::cerr << "1: " << lastKey << std::endl;
|
||||
@ -377,7 +377,7 @@ void BlockHashIndex::CalcHash(size_t current, void* source_void)
|
||||
size_t fprint = GetFprint(temp.c_str());
|
||||
size_t idx = cmph_search(hash, temp.c_str(),
|
||||
(cmph_uint32) temp.size());
|
||||
|
||||
|
||||
pv->Set(idx, i, fprint, m_orderBits, m_fingerPrintBits);
|
||||
i++;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void PhraseTableCreator::PrintInfo()
|
||||
|
||||
std::cerr << "Used options:" << std::endl;
|
||||
std::cerr << "\tText phrase table will be read from: " << m_inPath << std::endl;
|
||||
std::cerr << "\tOuput phrase table will be written to: " << m_outPath << std::endl;
|
||||
std::cerr << "\tOutput phrase table will be written to: " << m_outPath << std::endl;
|
||||
std::cerr << "\tStep size for source landmark phrases: 2^" << m_orderBits << "=" << (1ul << m_orderBits) << std::endl;
|
||||
std::cerr << "\tSource phrase fingerprint size: " << m_fingerPrintBits << " bits / P(fp)=" << (float(1)/(1ul << m_fingerPrintBits)) << std::endl;
|
||||
std::cerr << "\tSelected target phrase encoding: " << encodings[m_coding] << std::endl;
|
||||
@ -868,8 +868,9 @@ void PhraseTableCreator::FlushRankedQueue(bool force)
|
||||
{
|
||||
if(m_rankQueue.size()) {
|
||||
m_lastFlushedSourceNum++;
|
||||
if(m_lastFlushedSourceNum % 100000 == 0)
|
||||
if(m_lastFlushedSourceNum % 100000 == 0) {
|
||||
std::cerr << ".";
|
||||
}
|
||||
if(m_lastFlushedSourceNum % 5000000 == 0)
|
||||
{
|
||||
std::cerr << "[" << m_lastFlushedSourceNum << "]" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user