microsoft / LightLDA

Scalable, fast, and lightweight system for large-scale topic modeling
http://www.dmtk.io
MIT License
842 stars 235 forks source link

when I run the infer it will cause a segmentation fault #65

Open AugustGgGreen opened 6 years ago

AugustGgGreen commented 6 years ago

when I check the code in data_block.cpp the offset_buffer length is max_numdocument

try{
        offset_buffer_ = new int64_t[max_num_document_];
        }
        catch (std::bad_alloc& ba) {
            Log::Fatal("Bad Alloc caught: failed memory allocation for offset_buffer in DataBlock\n");
        }

but when you use the offsetbuffer just like this:

for (int32_t index = 0; index < num_document_; ++index)
        {
            documents_[index].reset(new Document(
                documents_buffer_ + offset_buffer_[index],
                documents_buffer_ + offset_buffer_[index + 1]));
        }

when I set the max_num_document equal to the num_documnet in the block file it will cause a error!