+ while (not(cin.eof())){
+ getline(cin,str); // Read line by line.
+// cin >> str; // Read word by word.
+ data = (uchar *) str.c_str();
+ csa->InsertText(data);
+ i++;
+ j+= str.size();
+ str.clear();
+ if ( i % 1000 == 0) {
+ std::cerr << "Inserted : " << i << " strings\n";
+ std::cerr << "Number of bytes inserted : " << j << "b \n";
+ std::cerr << "Heap usage used for strings: " << HeapProfiler::GetHeapConsumption() - heap_base
+ << "bytes\n";
+ std::cerr << "Ratio is : " << (float) (HeapProfiler::GetHeapConsumption() - heap_base) / ((float) j) <<"\n";
+
+ };
+
+ };
+
+/* the whole file as one string:
+ uchar *temp = Tools::GetFileContents("data.txt", 0);
+ csa->InsertText(temp);
+ delete [] temp;*/
+
+ std::cerr << "Creating new text collection with " << i << " strings (total " << j/1024 << " kb)\n";