Re: GC: Memory keeps growing

2015-04-15 Thread Chris via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 11:48:26 UTC, Rikki Cattermole wrote: On 15/04/2015 11:44 p.m., Chris wrote: My garbage collected app starts with ~10 MB in memory, however with every execution of code it grows by at least 0.2 MB (or more depending on the input). Although I can see memory being

Re: GC: Memory keeps growing

2015-04-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 16/04/2015 12:03 a.m., Chris wrote: On Wednesday, 15 April 2015 at 11:48:26 UTC, Rikki Cattermole wrote: On 15/04/2015 11:44 p.m., Chris wrote: My garbage collected app starts with ~10 MB in memory, however with every execution of code it grows by at least 0.2 MB (or more depending on the

Re: Converting void* to D array

2015-04-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/15/15 8:35 AM, CraigDillabaugh wrote: On Wednesday, 15 April 2015 at 11:18:03 UTC, Steven Schveighoffer wrote: immutable blocksize = GByte.sizeof * x_block_size * y_block_size; auto buffer = malloc(blocksize)[0..blocksize]; Also, you don't need to cast pointers to void *. Should be able

Re: GC: Memory keeps growing

2015-04-15 Thread Rikki Cattermole via Digitalmars-d-learn
On 15/04/2015 11:44 p.m., Chris wrote: My garbage collected app starts with ~10 MB in memory, however with every execution of code it grows by at least 0.2 MB (or more depending on the input). Although I can see memory being freed (say it goes up to 32 MB and drops to 14 MB), it keeps on growing

Re: Converting void* to D array

2015-04-15 Thread CraigDillabaugh via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 11:18:03 UTC, Steven Schveighoffer wrote: On 4/15/15 12:47 AM, Daniel Kozak wrote: On Wednesday, 15 April 2015 at 04:43:39 UTC, Daniel Kozák wrote: On Wed, 15 Apr 2015 04:24:20 + Craig Dillabaugh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com

Re: Converting void* to D array

2015-04-15 Thread CraigDillabaugh via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 11:18:03 UTC, Steven Schveighoffer wrote: clip Depends on what GByte is. If it doesn't contain pointers (I'm assuming its probably ubyte?), then it won't be scanned. clip -Steve Yes, GByte is an alias for ubyte.

Re: CTFE UFCs?

2015-04-15 Thread bitwise via Digitalmars-d-learn
On Tue, 14 Apr 2015 12:46:40 -0400, ketmar ket...@ketmar.no-ip.org wrote: On Tue, 14 Apr 2015 11:20:38 -0400, bitwise wrote: i believe that you can't do what you want in a way you want, 'cause UFCS is not working for template args. but you can do this: alias base(alias CC) =

Re: CTFE UFCs?

2015-04-15 Thread bitwise via Digitalmars-d-learn
On Tue, 14 Apr 2015 12:52:19 -0400, anonymous anonym...@example.com wrote: abstract class Refl { @property abstract string name() const; immutable(Refl) base() const; } class ClassRefl(T) : Refl { @property override string name() const { return T.stringof; }

Re: [dub]

2015-04-15 Thread y via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 15:22:27 UTC, Chris wrote: I get the following message from dub when using --build=release: Linking...

Re: Converting void* to D array

2015-04-15 Thread CraigDillabaugh via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 14:02:38 UTC, Steven Schveighoffer wrote: On 4/15/15 8:35 AM, CraigDillabaugh wrote: On Wednesday, 15 April 2015 at 11:18:03 UTC, Steven Schveighoffer wrote: immutable blocksize = GByte.sizeof * x_block_size * y_block_size; auto buffer =

Re: Converting void* to D array

2015-04-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/15/15 11:02 AM, CraigDillabaugh wrote: Nice. Thanks. I didn't realize you can slice a bare pointer like that. Does druntime have any way of making sure that is safe, or are you on your own? No, druntime cannot know what the pointer actually points at. This would not work in @safe

CT-String as a Symbol

2015-04-15 Thread Nordlöw
At https://github.com/nordlow/justd/blob/master/typecons_ex.d#L143 I can't figure out how to make the call to mixin genOps!I; expand to, for instance, mixin genOps!Index in the case when I = Index. Help please.

Re: Auto ref function : How is this possible ?

2015-04-15 Thread Ali Çehreli via Digitalmars-d-learn
On 04/15/2015 10:50 AM, Ali Çehreli wrote: pragma(msg) has been added to Programming in D but it is not available online yet: Sorry for the spam :( but apparently it is already online: http://ddili.org/ders/d.en/templates.html#ix_templates.pragma Ali

Re: CTFE UFCs?

2015-04-15 Thread bitwise via Digitalmars-d-learn
On Tue, 14 Apr 2015 12:52:19 -0400, anonymous anonym...@example.com wrote: Parting thoughts: I don't know where you're heading with this. But so far I don't see what it would buy you over std.traits and TypeInfo/TypeInfo_Class. Forgot to mention support for runtime reflection. See here:

Re: Auto ref function : How is this possible ?

2015-04-15 Thread Ali Çehreli via Digitalmars-d-learn
On 04/13/2015 07:44 AM, matovitch wrote: Thanks for the tip ! I was looking at something like this. pragma(msg) has been added to Programming in D but it is not available online yet:

Re: About @ and UDA

2015-04-15 Thread ketmar via Digitalmars-d-learn
On Wed, 15 Apr 2015 08:53:05 +, Andrea Fontana wrote: My 2 cents. If I remember correctly, @ prefix in @safe, @trusted, @system, etc was added just to avoid keywords pollution, right? Now UDA uses the same prefix: if some new keywords/properties/attributes will be added to D, the same

Re: CT-String as a Symbol

2015-04-15 Thread Ali Çehreli via Digitalmars-d-learn
On 04/15/2015 09:21 AM, Nordlöw wrote: At https://github.com/nordlow/justd/blob/master/typecons_ex.d#L143 I can't figure out how to make the call to mixin genOps!I; expand to, for instance, mixin genOps!Index This seems to work: mixin genOps!(mixin(I)); in the case when

Re: CT-String as a Symbol

2015-04-15 Thread Ali Çehreli via Digitalmars-d-learn
On 04/15/2015 12:19 PM, Nordlöw wrote: I'm using DMD 2.067. Mee too. The following is the minimum amount of code I used, which compiles: import std.traits; import std.range; struct Index(T = size_t) if (isUnsigned!T) { this(T ix) { this._ix = ix; } T opCast(U : T)() const { return

Re: CT-String as a Symbol

2015-04-15 Thread Nordlöw
On Wednesday, 15 April 2015 at 19:15:36 UTC, Nordlöw wrote: errors typecons_ex.d(135,5): Error: mixin typecons_ex.IndexedBy!(int[3], I).IndexedBy.genOps!I does not match template declaration genOps(T) typecons_ex.d(152,12): Error: template instance typecons_ex.IndexedBy!(int[3], I) error

Re: CT-String as a Symbol

2015-04-15 Thread Nordlöw
I'm using DMD 2.067.

Re: CT-String as a Symbol

2015-04-15 Thread Nordlöw
On Wednesday, 15 April 2015 at 17:03:36 UTC, Ali Çehreli wrote: This seems to work: mixin genOps!(mixin(I)); I'm afraid not: mixin genOps!(mixin(I)); errors typecons_ex.d(135,5): Error: mixin typecons_ex.IndexedBy!(int[3], I).IndexedBy.genOps!I does not match template declaration

Re: CT-String as a Symbol

2015-04-15 Thread Nordlöw
On Wednesday, 15 April 2015 at 20:12:27 UTC, Ali Çehreli wrote: Ali I cracked it: Reason: I hade a failing unittest using it as auto xs = x.indexedBy!I; which I changed to auto xs = x.indexedBy!Ix; For some reason the mixin magic becomes confused when I equals I. Do you have

Re: CT-String as a Symbol

2015-04-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/15/15 6:42 PM, Nordlöw wrote: On Wednesday, 15 April 2015 at 20:12:27 UTC, Ali Çehreli wrote: Ali I cracked it: Reason: I hade a failing unittest using it as auto xs = x.indexedBy!I; which I changed to auto xs = x.indexedBy!Ix; For some reason the mixin magic becomes

Re: CT-String as a Symbol

2015-04-15 Thread Ali Çehreli via Digitalmars-d-learn
On 04/15/2015 03:42 PM, Nordlöw wrote: On Wednesday, 15 April 2015 at 20:12:27 UTC, Ali Çehreli wrote: Ali I cracked it: Reason: I hade a failing unittest using it as auto xs = x.indexedBy!I; which I changed to auto xs = x.indexedBy!Ix; For some reason the mixin magic

Re: Type trait alias parameters being either a string or a type

2015-04-15 Thread Nordlöw
On Wednesday, 15 April 2015 at 08:42:31 UTC, Nordlöw wrote: As a follow up to http://forum.dlang.org/thread/waxtzdemkuzvqdwil...@forum.dlang.org#post-waxtzdemkuzvqdwilulj:40forum.dlang.org I'm trying to create a type trait isIndexableBy at

Type trait alias parameters being either a string or a type

2015-04-15 Thread Nordlöw
As a follow up to http://forum.dlang.org/thread/waxtzdemkuzvqdwil...@forum.dlang.org#post-waxtzdemkuzvqdwilulj:40forum.dlang.org I'm trying to create a type trait isIndexableBy at https://github.com/nordlow/justd/blob/isIndexableBy-problem/typecons_ex.d DMD complains typecons_ex.d(78,30):

About @ and UDA

2015-04-15 Thread Andrea Fontana via Digitalmars-d-learn
My 2 cents. If I remember correctly, @ prefix in @safe, @trusted, @system, etc was added just to avoid keywords pollution, right? Now UDA uses the same prefix: if some new keywords/properties/attributes will be added to D, the same problem will come back again... Is it a crazy idea to

Re: About @ and UDA

2015-04-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2015-04-15 10:53, Andrea Fontana wrote: My 2 cents. If I remember correctly, @ prefix in @safe, @trusted, @system, etc was added just to avoid keywords pollution, right? Now UDA uses the same prefix: if some new keywords/properties/attributes will be added to D, the same problem will come

Re: [dub] Release build fails with 2.067.0

2015-04-15 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 10:11:17 UTC, Chris wrote: On Tuesday, 14 April 2015 at 15:58:18 UTC, Chris wrote: Sorry, I forgot the title the first time around! I get the following message from dub when using --build=release: Linking...

Re: [dub] Release build fails with 2.067.0

2015-04-15 Thread Chris via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 10:26:55 UTC, John Colvin wrote: On Wednesday, 15 April 2015 at 10:11:17 UTC, Chris wrote: On Tuesday, 14 April 2015 at 15:58:18 UTC, Chris wrote: Sorry, I forgot the title the first time around! I get the following message from dub when using --build=release:

Re: [dub] Release build fails with 2.067.0

2015-04-15 Thread Chris via Digitalmars-d-learn
On Tuesday, 14 April 2015 at 15:58:18 UTC, Chris wrote: Sorry, I forgot the title the first time around! I get the following message from dub when using --build=release: Linking...

Re: [dub] Release build fails with 2.067.0

2015-04-15 Thread John Colvin via Digitalmars-d-learn
On Wednesday, 15 April 2015 at 10:31:01 UTC, Chris wrote: On Wednesday, 15 April 2015 at 10:26:55 UTC, John Colvin wrote: On Wednesday, 15 April 2015 at 10:11:17 UTC, Chris wrote: On Tuesday, 14 April 2015 at 15:58:18 UTC, Chris wrote: Sorry, I forgot the title the first time around! I get

Re: String Index Support for IndexedBy

2015-04-15 Thread Nordlöw
On Tuesday, 14 April 2015 at 19:38:10 UTC, Nordlöw wrote: I have implemented a type constructor [Ii]ndexedBy at https://github.com/nordlow/justd/blob/master/typecons_ex.d#L97 restricted by https://github.com/nordlow/justd/blob/master/typecons_ex.d#L78 See unittests below for usage. I would

Re: Converting void* to D array

2015-04-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/15/15 12:47 AM, Daniel Kozak wrote: On Wednesday, 15 April 2015 at 04:43:39 UTC, Daniel Kozák wrote: On Wed, 15 Apr 2015 04:24:20 + Craig Dillabaugh via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Hi. I want to call a C library function that returns a data buffer as

GC: Memory keeps growing

2015-04-15 Thread Chris via Digitalmars-d-learn
My garbage collected app starts with ~10 MB in memory, however with every execution of code it grows by at least 0.2 MB (or more depending on the input). Although I can see memory being freed (say it goes up to 32 MB and drops to 14 MB), it keeps on growing slowly but surely. I use structs