On Tuesday, June 07, 2016 21:00:06 H. S. Teoh via Digitalmars-d wrote: > Actually, I'm not sure how much of Phobos actually depends on the GC. > Most of the stuff I use frequently are from std.range and std.algorithm, > and we've pretty much gotten rid of GC-dependence from most of the stuff > there. Phobos modules that are GC-heavy ought to be avoided in > high-performance code anyway; the only problematic case I can think of > being std.string which greedily allocates. But we've been making > progress on that over the past year or so by turning many of the > functions into range-based algorithms rather than string-specific.
As I understand it, the big problems relate to lambdas and closures and the like. As it stands, it's way too easy to end up allocating when using stuff like std.algorithm even though it doesn't obviously allocate. And on some level at least, I think that that's more an issue of language improvements than library improvements. But no, explicit use of the GC in Phobos is not particularly heavy. Array-related stuff often allocates, and the few places in Phobos that use classes allocate, but in general, Phobos really doesn't do much in the way explicit allocations. It's the implicit ones that are the killer. - Jonathan M Davis
