On Saturday, 12 August 2017 at 08:16:56 UTC, Temtaime wrote:
Collect - is a hit to the GC, not an order. It can ignore this
request.
As far as I can tell, it is an order. From the GC code[1]:
void collect() nothrow
{
fullCollect();
}
...
size_t fullCollect()
On 8/12/17 4:16 AM, Temtaime wrote:
Collect - is a hit to the GC, not an order. It can ignore this request.
Hm.. where is this documented? I agree that the GC may not clean up all
memory that could be legitimately cleaned up, but that's not because it
didn't do a collection.
-Steve
Am Fri, 11 Aug 2017 18:44:56 +
schrieb bitwise :
> […]
That can't work and here is why: Druntime employs a
conservative GC that will treat several things as potential
pointers to GC memory. From the top of my head, the entire
stack as well as void[] arrays and unions
On Saturday, 12 August 2017 at 17:52:47 UTC, Dgame wrote:
[...]
auto s(T, size_t n)(T[n] values) {
return values;
}
assert(equal(a[], [S(0), S(1)].s));
This seems to work, but I'm trying to determine if it's 100%
guaranteed safe.
Tacking on @nogc doesn't seem to stop it from
On Saturday, 12 August 2017 at 17:25:36 UTC, bitwise wrote:
On Saturday, 12 August 2017 at 08:16:56 UTC, Temtaime wrote:
Collect - is a hint to the GC, not an order. It can ignore
this request.
If this is the case, then D's GC should have an option to force
collection like C#'s GC:
On Saturday, 12 August 2017 at 08:16:56 UTC, Temtaime wrote:
Collect - is a hint to the GC, not an order. It can ignore this
request.
If this is the case, then D's GC should have an option to force
collection like C#'s GC:
https://msdn.microsoft.com/en-us/library/bb495757(v=vs.110).aspx
On Friday, 11 August 2017 at 22:36:27 UTC, bitwise wrote:
On Friday, 11 August 2017 at 19:01:44 UTC, Yuxuan Shui wrote:
On Friday, 11 August 2017 at 18:44:56 UTC, bitwise wrote:
[...]
My guess is a pointer to the array still lives somewhere on
the stack. This gives the expected output:
void
On Friday, 11 August 2017 at 19:01:44 UTC, Yuxuan Shui wrote:
On Friday, 11 August 2017 at 18:44:56 UTC, bitwise wrote:
[...]
My guess is a pointer to the array still lives somewhere on the
stack. This gives the expected output:
void f()
{
S[] x = [S(1), S(1)];
writeln("GC allocated:
On Friday, 11 August 2017 at 18:44:56 UTC, bitwise wrote:
struct S {
static int count = 0;
this(int x) { ++count; }
this(this) { ++count; }
~this() { --count; }
}
int main(string[] argv)
{
S[] x = [S(1), S(1)];
writeln("GC allocated: ", (GC.addrOf(x.ptr) !is null));
struct S {
static int count = 0;
this(int x) { ++count; }
this(this) { ++count; }
~this() { --count; }
}
int main(string[] argv)
{
S[] x = [S(1), S(1)];
writeln("GC allocated: ", (GC.addrOf(x.ptr) !is null));
x = null;
GC.collect();
writeln("live objects: ",
10 matches
Mail list logo