On Saturday, 17 September 2016 at 21:44:22 UTC, Stefan Koch wrote:
On Saturday, 17 September 2016 at 21:12:08 UTC, Ryan wrote:
Is there an alternative to reporting bugs via bugzilla?
I tried to open an account, but they recommend not using your
main e-mail address because it will be posted to the web for
all the spammers to find. But I don't have another e-mail
address, and it seems a bit much to create a fake e-mail
account for a few bug reports.
I also tried to post to the threads about bugs, but they are
all bugzilla archives.
I've narrowed it down to a pretty simple little program that
demonstrates the bug, and even tried it on DMD/LDC2, for mac,
ubuntu, and windows 10.
Thanks,
Post the program somewhere otherwise we cannot help.
import std.experimental.allocator;
import std.experimental.allocator.gc_allocator;
import std.experimental.allocator.mallocator;
import std.experimental.allocator.building_blocks;
import std.stdio;
import std.range;
struct S
{
// The allocator used for this instance
private IAllocator myAlloc;
// My payload
private double[] _payload;
// No empty payloads allowed
@disable this();
// Create an initialized payload
this(size_t sz, double init, IAllocator alloc = theAllocator)
{
// Set the allocator first!
myAlloc = alloc;
_payload = myAlloc.makeArray!double(sz, init);
assert(_payload, "Failed allocation...");
assert(_payload.length == sz, "Something is awry.");
assert(_payload[0] == init, "Copy failed.");
assert(_payload[$-1] == init, "Copy failed.");
}
// postblit - deep copy payload - I have an implementation for
this, but it
// is not needed to demo seg fault
@disable this(this);
// Destructor to return memory
~this()
{
// No way _payload is null
assert(_payload, "_payload is null");
// So give it back, I'm done with it for now
myAlloc.dispose(_payload);
}
// Something to do with the object
void ack()
{
writeln("ack"); stdout.flush();
}
// Lots of other stuff.
// .
// .
// .
}
void main()
{
// Always works
foreach(i; iota(1,5_000))
{
writef("Doing default %d...", i); stdout.flush();
S s = S(i, i*i);
s.ack();
}
// Always works
IAllocator alloc = allocatorObject(GCAllocator.instance);
foreach(i; iota(1,5_000))
{
writef("Doing GCAllocator %d...", i); stdout.flush();
S s = S(i, i*i, alloc);
s.ack();
}
// Always works
alloc = allocatorObject(Mallocator.instance);
foreach(i; iota(1,5_000))
{
writef("Doing Mallocator %d...", i); stdout.flush();
S s = S(i, i*i, alloc);
s.ack();
}
// This one will seg fault on linux/mac/ldc2 win, not dmd
windows. Why?
auto ft = FreeTree!Mallocator();
alloc = allocatorObject();
foreach(i; iota(1,5_000))
{
writef("Doing FreeTree!Mallocator %d...", i); stdout.flush();
S s = S(i, i*i, alloc);
s.ack();
}
// This one will seg fault on linux/mac/ldc2 win, not dmd
windows. Why?
auto ft2 = FreeTree!GCAllocator();
alloc = allocatorObject();
foreach(i; iota(1,5_000))
{
writef("Doing FreeTree!GCAllocator %d...", i); stdout.flush();
S s = S(i, i*i, alloc);
s.ack();
}
}