[Issue 13159] std.socket.getAddress allocates once per DNS lookup hit
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jul 19 09:11:33 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13159
Orvid King <blah38621 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |blah38621 at gmail.com
--- Comment #1 from Orvid King <blah38621 at gmail.com> ---
Assuming that infos has a length property, it would be better yet to simply do:
auto infos = getAddressInfo(hostname, service);
auto results = new Address[infos.length];
Which would result in exactly the amount of memory needed being allocated, and
only 1 allocation being done. I would also suggest the possibility of adding an
OutputRange based version.
--
More information about the Digitalmars-d-bugs
mailing list