Allocating a wstring on the stack (no GC)?

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Thu May 8 02:26:25 PDT 2014


John Colvin:

> Sure, you have to keep track of the memory to make sure it 
> doesn't survive past the current scope (or at least isn't used 
> past that point, depending on how security critical your 
> application is), but that's often trivial to do and saving the 
> extra allocation can make a big difference to performance.

It's also bug-prone, so better to limit that usage to only the 
parts of the code that need the performance difference (often 
it's the profiler that tells where to use that). Rust language 
allows to perform similar things safely.

Bye,
bearophile


More information about the Digitalmars-d mailing list