A
Avalon1178
Hi,
I have an application that periodically uses a std::string variable
which is assigned a VERY VERY large string (15000000+ bytes long).
This application is essentially a daemon, and it polls a data set
which can have a lot of information and it is concatenated in this
single string variable object. When the daemon finishes its job, it
goes to sleep, but before doing so, it "clears" this variable so it
can be reused again in the next poll.
Currently, when I say clear, all I'm doing to the variable is setting
it to an emtpy string (var = ""), rather than calling the .clear()
member function because of my concern with std::string performance of
actually zeroing out this very large buffer. My question is, is this
wise? Despite this large record, is it advised to use .clear()
regardless rather than setting it to empty string? Any potential
implications on this? I ran valgrind on my application and it doesn't
report a memory leak if I just set the variable to empty string....
Avalon1178
I have an application that periodically uses a std::string variable
which is assigned a VERY VERY large string (15000000+ bytes long).
This application is essentially a daemon, and it polls a data set
which can have a lot of information and it is concatenated in this
single string variable object. When the daemon finishes its job, it
goes to sleep, but before doing so, it "clears" this variable so it
can be reused again in the next poll.
Currently, when I say clear, all I'm doing to the variable is setting
it to an emtpy string (var = ""), rather than calling the .clear()
member function because of my concern with std::string performance of
actually zeroing out this very large buffer. My question is, is this
wise? Despite this large record, is it advised to use .clear()
regardless rather than setting it to empty string? Any potential
implications on this? I ran valgrind on my application and it doesn't
report a memory leak if I just set the variable to empty string....
Avalon1178