You're going to use at least sizeof(std::vector<Entry>) + N * sizeof(Entry)
bytes, and short string optimization means that if all of your strings are short you'll probably use exactly that much.
How much memory that is will depend on your compiler, standard library implementation, and architecture. Assuming you're compiling for x86_64, sizeof(Entry)
will likely be either 40 or 48 bytes (MSCRT and libstdc++ have 32 byte std::string
s, libc++ uses 24 byte std::string
s). sizeof(std::vector<Entry>)
is likely 24 bytes. That brings total memory usage up to a likely 24 + N * 48
bytes.
If your strings are longer than about 15 characters then std::string
will have to store the actual character data in an external allocation. That can add an arbitrary extra amount of memory usage.
Note that this is just the memory directly used to store your objects. The memory allocator may allocate memory from the system in larger chunks, and there's also some overhead used for tracking what memory is allocated and what is available.