Divider Connect on Facebook Connect on Instagram Connect on Twitter YouTube email Email RSS Icon >

C++ Strings vs. Char Arrays

WHICH USES MORE MEMORY?

November 18, 2011
10 Million Strings (std::string)
String Length (bytes) Memory (MB)
1 542.292
8 543.096
9 547.268
15 546.128
16 698.012
24 702.196
31 704.872
32 857.724
40 859.98
47 860.78
48 1016.716
56 1016.992
63 1017.848
64 1171.66
72 1173.552
144 1781.184
288 3065.48
10 Million Strings (CHAR arrays)
String Length (bytes) Memory (MB)
1 391.624
8 390.84
16 390.592
17 390.912
23 391.28
24 391.368
25 548.064
26 547.996
28 548.932
31 543.996
32 547.601
40 546.872
41 704.116
44 704.344
47 703.808
48 704.104
49 704.384
56 705.616
63 705.692
64 860.584
72 861.088
144 1634.172
288 3048.912