3 ms·
It would only lead to a memory leak depending on your usage, but it’s pretty common gotcha that can be annoying with or without memory issues. The following is
by hamandcheese 9y ago
It would only lead to a memory leak depending on your usage, but it’s pretty common gotcha that can be annoying with or without memory issues.
The following is some pretty good reading on the matter, and the example given is also one that would lead to a memory leak:
https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument https://stackoverflow.com/questions/1132941/least-astonishme...