I don\'t know what to think here...
We have a component that runs as a service. It runs perfectly well on my local machine, but on some other machine (on both machine RA
Another long shot: you don't say in which of the three operations the error occurs (construction, <<
or log), but the problem may be memory fragmentation, rather than memory consumption. Maybe stringstream can't find a contiguous memory block long enough to hold a couple of Kb.
If this is the case, and if you exercise that function on the first day (without mishap) then you could make the stringstream a static variable and reuse it. As far as I know stringstream does not deallocate it's buffer space during its lifetime, so if it establishes a big buffer on the first day it will continue to have it from then on (for added safety you could run a 5Kb dummy string through it when it is first constructed).