Setting the limitation of total bytes of model

Locate the ReadProtoFromBinaryFile( ) in io.cpp, then  increase the params of SetTotalBytesLimit( ).

bool ReadProtoFromBinaryFile(const char* filename, Message* proto)
{
    int fd = open(filename, O_RDONLY);
    CHECK_NE(fd, -1) << "File not found: " << filename;
    ZeroCopyInputStream* raw_input = new FileInputStream(fd);
    CodedInputStream* coded_input = new CodedInputStream(raw_input);

    //void SetTotalBytesLimit(int total_bytes_limit, int warning_threshold);  

    coded_input->SetTotalBytesLimit(1073741824, 536870912);

...

}

你可能感兴趣的:(Setting the limitation of total bytes of model)