On Thursday, 28 February 2019 at 04:26:47 UTC, Sam Johnson wrote:
Update: it seems that all I need to do is GC.addRoot(output);
and memory leak goes away. I think I have answered my own
question.
If you know what you are doing. Otherwise you just postpone
troubles due to mixed
On Thursday, 28 February 2019 at 03:33:25 UTC, Sam Johnson wrote:
```
string snappyCompress(const string plaintext) {
import deimos.snappy.snappy : snappy_compress,
snappy_max_compressed_length, SNAPPY_OK;
import core.stdc.stdlib : malloc, free;
import std.string :
On Thursday, 28 February 2019 at 03:33:25 UTC, Sam Johnson wrote:
How can I get the GC to automatically garbage collect the
`output` malloc call by tracking the returned `ret` reference?
If you want it GC managed, just GC allocate it instead of
mallocing it.
char *output = cast(char *)
On Thursday, 28 February 2019 at 04:26:47 UTC, Sam Johnson wrote:
Update: it seems that all I need to do is GC.addRoot(output);
and memory leak goes away. I think I have answered my own
question.
That shouldn't have any effect at all. GC.addRoot makes the GC
consider that pointer to always
On Thursday, 28 February 2019 at 03:35:45 UTC, Sam Johnson wrote:
Ignore the `.clone()` call -- that wasn't supposed to be here
-- I thought maybe string.clone() might exist but it turns out
it does not.
It is called `.dup` ( for a mutable copy) or `.idup` (for an
immutable copy).
Though
On Thursday, 28 February 2019 at 03:35:45 UTC, Sam Johnson wrote:
On Thursday, 28 February 2019 at 03:33:25 UTC, Sam Johnson
wrote:
[...]
Ignore the `.clone()` call -- that wasn't supposed to be here
-- I thought maybe string.clone() might exist but it turns out
it does not.
Update: it
On Thursday, 28 February 2019 at 03:33:25 UTC, Sam Johnson wrote:
```
string snappyCompress(const string plaintext) {
import deimos.snappy.snappy : snappy_compress,
snappy_max_compressed_length, SNAPPY_OK;
import core.stdc.stdlib : malloc, free;
import std.string :
```
string snappyCompress(const string plaintext) {
import deimos.snappy.snappy : snappy_compress,
snappy_max_compressed_length, SNAPPY_OK;
import core.stdc.stdlib : malloc, free;
import std.string : fromStringz, toStringz;
char *input = cast(char *)
On Wednesday, 27 February 2019 at 22:56:14 UTC, Michelle Long
wrote:
Trying to get dcompute to work... after a bunch of issues
dealing with all the crap this is what I can't get past:
Error: unrecognized `pragma(LDC_intrinsic)
This is actually from the ldc.intrinsics file, which I had to
Trying to get dcompute to work... after a bunch of issues dealing
with all the crap this is what I can't get past:
Error: unrecognized `pragma(LDC_intrinsic)
This is actually from the ldc.intrinsics file, which I had to
rename from .di to d so it would be included in by VisualD.
I upgraded
I rewrote it again:
https://github.com/vporton/struct-params-dlang/blob/f50f7e5919f90b1d06bf0cc08e3055548aad1797/source/struct_params.d
But it does not work :-( What is my error?
source/struct_params.d(43,60): Error: function expected before
`()`, not `()` of type `()`
On Wednesday, 27 February 2019 at 20:03:15 UTC, Q. Schroll wrote:
For any type constructors like const, I can use ConstOf!T to
get `T` with const attached. For a delegate/function type DG,
e.g. int delegate(int), how can I get the @safe version of that
type, i.e. int delegate(int) @safe?
I
For any type constructors like const, I can use ConstOf!T to get
`T` with const attached. For a delegate/function type DG, e.g.
int delegate(int), how can I get the @safe version of that type,
i.e. int delegate(int) @safe?
I tried
alias SafeOf(DG) = DG @safe;
but it didn't compile.
The
On Wednesday, 27 February 2019 at 03:53:35 UTC, Victor Porton
wrote:
After following your suggestion to rewrite it with Stride it
does not work either. I assume the error is somehow related to
allSatisfy!.
On 27.02.19 19:10, Dukc wrote:
I tested a bit, and it appears that attribute inference is not done at
all for templates inside structs -the attribute need not be a delegate:
struct S
{
static int fImpl(Ret)() { return Ret.init; }
pragma(msg,
On Wednesday, 27 February 2019 at 17:23:21 UTC, Q. Schroll wrote:
For whatever reason, when I put the code in a struct, the @safe
testing line tells me, it's @system now.
I tested a bit, and it appears that attribute inference is not
done at all for templates inside structs -the attribute
On Wednesday, 27 February 2019 at 18:06:49 UTC, Stefan Koch wrote:
the struct gets drawn into your delegate-context.
and I guess that taints the function.
Even if it did, it should not make the delegate @system. And it
does not, since this manifest with static functions and function
On Wednesday, 27 February 2019 at 17:23:21 UTC, Q. Schroll wrote:
I have a template function `fImpl` I whish to instantiate
manually using the new name `f`. Reason is simple: `f` should
not be a template, but overloading it makes it easier that way.
Nothing's more simple in D:
[...]
the
I have a template function `fImpl` I whish to instantiate
manually using the new name `f`. Reason is simple: `f` should not
be a template, but overloading it makes it easier that way.
Nothing's more simple in D:
int fImpl(T)(T value) { return cast(int) value; }
alias f = fImpl!int;
On Wednesday, 27 February 2019 at 13:15:06 UTC, Victor Porton
wrote:
.enumerate does not work for compile-time sequences. Consider
for the sake of discussion the following nonsense (I know it
cannot be done without enumerate) code:
import std.meta;
import std.range;
string join(Fields...)()
On Wednesday, 27 February 2019 at 13:15:06 UTC, Victor Porton
wrote:
.enumerate does not work for compile-time sequences. Consider
for the sake of discussion the following nonsense (I know it
cannot be done without enumerate) code:
I want namely integer (or size_t) index!
.enumerate does not work for compile-time sequences. Consider for
the sake of discussion the following nonsense (I know it cannot
be done without enumerate) code:
import std.meta;
import std.range;
string join(Fields...)() {
enum f(size_t i) = __traits(identifier, Fields[i]);
return
On Monday, 25 February 2019 at 18:54:03 UTC, Jacob Carlborg wrote:
On 2019-02-24 23:51, 0x wrote:
How to disable dub from checking internet before building,
it's slowing down build whenever it does this.
I thought that was fixed [1]. Or is it doing something else?
[1]
On Tuesday, 26 February 2019 at 18:50:39 UTC, Mitacha wrote:
Hi everyone,
I checked, just out of curiosity, what is staticMap's
implementation. It's implemented using recursive, this made me
think if there is way to use static foreach instead. I came out
with following solution:
On Wednesday, 27 February 2019 at 03:53:35 UTC, Victor Porton
wrote:
After following your suggestion to rewrite it with Stride it
does not work either. I assume the error is somehow related to
allSatisfy!.
25 matches
Mail list logo