Fixed memory leak

This commit is contained in:
Marcin Junczys-Dowmunt 2012-08-14 14:27:41 +02:00
parent d232c7bd66
commit 505b5f455d
2 changed files with 7 additions and 6 deletions

View File

@ -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,13 +357,14 @@ 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;

View File

@ -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;