Constructor called instead of opAssign()

2021-02-13 Thread frame via Digitalmars-d-learn
I have generic types that are initialized by a base class for each derived object: struct S(T) { this(T val) { value = 100; } void opAssign(T val) { value = val; } T value; } class A { this(this T)() { foreach (property; __traits(allMembers,

Re: Are there any containers that go with allocators?

2021-02-13 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 12:18:41 UTC, John Burton wrote: Normally I'm happy with the GC containers in D, they work well and suit my use. I have a few uses that would benefit from allocation in memory arenas or local stack based allocation. Looks like std.experimental has allocators

Re: Why filling AA in shared library freezes execution?

2021-02-13 Thread Siemargl via Digitalmars-d-learn
On Saturday, 6 February 2021 at 15:21:17 UTC, Siemargl wrote: extern(C) __gshared string[] rt_options = [ "gcopt=parallel:0" ]; LDC 1.24 is also affected and rt_options helps

Re: Minimize GC memory footprint

2021-02-13 Thread Siemargl via Digitalmars-d-learn
On Saturday, 13 February 2021 at 19:14:32 UTC, frame wrote: On Saturday, 13 February 2021 at 17:54:53 UTC, Siemargl wrote: And it works too, for 32-bit also =) Consuming about 100MB RAM. Yes, Appender is nice but I had no control about .data since the real property is private so I chose

Re: Is this the proper way to do it?

2021-02-13 Thread frame via Digitalmars-d-learn
On Saturday, 13 February 2021 at 05:52:34 UTC, Jack wrote: I have a base class A, where I make specific operator depending on the derived class type. Currently I'm using something like this: c is a class derived from A bool shouldDoX = (cast(X)c) !is null || (cast(Y)c) !is null || (cast(K)c)

Re: Minimize GC memory footprint

2021-02-13 Thread frame via Digitalmars-d-learn
On Saturday, 13 February 2021 at 17:54:53 UTC, Siemargl wrote: And it works too, for 32-bit also =) Consuming about 100MB RAM. Yes, Appender is nice but I had no control about .data since the real property is private so I chose that edgy example to find the problem with the GC. As someone

Re: vibe.d json deserializeJson!Foo and ddbc.update!Foo

2021-02-13 Thread Chris Bare via Digitalmars-d-learn
On Saturday, 13 February 2021 at 01:21:56 UTC, Steven Schveighoffer wrote: On 2/12/21 6:22 PM, Chris Bare wrote: [...] Does @ignore work? That's a UDA that tells vibe to ignore the field. Though I don't know if it means it leaves it alone completely.

Re: Minimize GC memory footprint

2021-02-13 Thread Siemargl via Digitalmars-d-learn
On Tuesday, 9 February 2021 at 04:05:04 UTC, frame wrote: On Saturday, 6 February 2021 at 20:24:00 UTC, frame wrote: Hmmm.. with -m64 it's reporting 80 MB used, 203 MB are really marked as private bytes. Constant. If I use GC.minimize() it goes up and down and sometimes consumes more than 203

Re: Is this the proper way to do it?

2021-02-13 Thread Rumbu via Digitalmars-d-learn
On Saturday, 13 February 2021 at 05:52:34 UTC, Jack wrote: I have a base class A, where I make specific operator depending on the derived class type. Currently I'm using something like this: c is a class derived from A bool shouldDoX = (cast(X)c) !is null || (cast(Y)c) !is null || (cast(K)c)

Re: Trying to reduce memory usage

2021-02-13 Thread Daniel N via Digitalmars-d-learn
On Saturday, 13 February 2021 at 04:19:17 UTC, Ali Çehreli wrote: On 2/11/21 6:22 PM, H. S. Teoh wrote: >bool[size_t] hashes; I would start with an even simpler solution until it's proven that there still is a memory issue: import std.stdio; void main() { bool[string] lines;