Bigram bigram;
bigram.attach(bigram_filename, ATTACH_CREATE|ATTACH_READWRITE);
- char* linebuf = (char *)malloc ( 1024 * sizeof (char) );
- size_t size = 1024;
+ char* linebuf = NULL;
+ size_t size = 0;
phrase_token_t last_token, cur_token = last_token = 0;
while( getline(&linebuf, &size, stdin) ){
if ( feof(stdin) )
delete single_gram;
}
}
-
+ free(linebuf);
+
return 0;
}
bigram.attach(bigram_filename, ATTACH_CREATE|ATTACH_READWRITE);
- char* linebuf = (char *)malloc ( 1024 * sizeof (char) );
- size_t size = 1024;
+ char* linebuf = NULL;
+ size_t size = 0;
phrase_token_t last_token, cur_token = last_token = 0;
while( getline(&linebuf, &size, stdin) ){
if ( feof(stdin) )
delete single_gram;
}
}
+
+ free(linebuf);
MemoryChunk * new_chunk = new MemoryChunk;
phrase_index.store(1, new_chunk);