That's not the right way to write multiple records. What you're doing is
writing multiple address books without proper boundaries between them. The
right thing to do would be to add multiple "person"s to one address book,
then write it once.
That said, the file produced by your code should grow
I am using add_person.cc provided in the sample file. The only change I have
done is,
a while loop around this code. So it's same record inserted multiple times.
// Write the new address book back to disk.fstream output(argv[1], ios::out
| ios::trunc | ios::binary);
*int nRecords = 10;*
*whil
The most likely cause is a bug in your code where there's something you
aren't clearing each time you write a record, so at each iteration in your
loop, the record you're writing is getting bigger. Of course I can't say
for sure without seeing the code.
Daniel
On Mon, Mar 22, 2010 at 1:13 PM, Vi
Hi Jason,
Thanks for the quick reply.
I am not surprised by the increase in file size, But I am under impression
that If I insert the same record
thousand times, the size of file should be large accordingly,
e.g, assume that one record generates the file of size 32 bytes; with1024
records should
If you're measuring using sizeof(), you won't account for memory allocated
by subobjects (strings and submessages are stored as pointers). You should
use Message::SpaceUsed() instead. The inmemory vs serialized size is going
to depend on your proto definition and how you use it. If you have a lot o
I was testing to see the upper limit for numbers of records in one
file.
I used the addressbook example, and I noticed that for one record
it generates file double the size.
for ex. size of the class I was putting into it was 48 bytes and the
file
was of 97 bytes on ubuntu 9.10.
Now, I go test it