Re: GC memory fragmentation

2021-04-11 Thread frame via Digitalmars-d-learn
On Sunday, 11 April 2021 at 09:10:22 UTC, tchaloupka wrote: Hi, we're using vibe-d (on Linux) for a long running REST API server and have problem with constantly growing memory until system kills it with OOM killer. Do you have a manual GC.free() in your code, maybe with a larger array?

Re: Range Error

2021-04-11 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/11/21 4:41 PM, Bastiaan Veelo wrote: On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d   for(int i=7;7>=0;i--) ``` This will go on forever, so you get a

Re: How to build a specific library version with dub?

2021-04-11 Thread martinm via Digitalmars-d-learn
On Sunday, 11 April 2021 at 13:43:47 UTC, martinm wrote: I'm trying to use wayland-d which depends on derelict-util-2.0.6. DUB can't download the zip and fails. I download the zip to ~/.dub/packages/derelict-util folder, unzip and build. DUB builds **DerelictUtil.a ~master**. Trying to

Re: How to build a specific library version with dub?

2021-04-11 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 11 April 2021 at 13:43:47 UTC, martinm wrote: I'm trying to use wayland-d which depends on derelict-util-2.0.6. DUB can't download the zip and fails. I download the zip to ~/.dub/packages/derelict-util folder, unzip and build. DUB builds **DerelictUtil.a ~master**. That's not how

Re: GC memory fragmentation

2021-04-11 Thread Nathan S. via Digitalmars-d-learn
On Sunday, 11 April 2021 at 09:10:22 UTC, tchaloupka wrote: Hi, we're using vibe-d (on Linux) for a long running REST API server and have problem with constantly growing memory until system kills it with OOM killer. One thing that comes to mind: is your application compiled as 32-bit? The

Re: GC memory fragmentation

2021-04-11 Thread tchaloupka via Digitalmars-d-learn
On Sunday, 11 April 2021 at 12:20:39 UTC, Nathan S. wrote: One thing that comes to mind: is your application compiled as 32-bit? The garbage collector is much more likely to leak memory with a 32-bit address space since it much more likely for a random int to appear to be a pointer to the

How to build a specific library version with dub?

2021-04-11 Thread martinm via Digitalmars-d-learn
I'm trying to use wayland-d which depends on derelict-util-2.0.6. DUB can't download the zip and fails. I download the zip to ~/.dub/packages/derelict-util folder, unzip and build. DUB builds **DerelictUtil.a ~master**. Trying to rebuild wayland-d, DUB can't find **derelict-util-2.0.6**

GC memory fragmentation

2021-04-11 Thread tchaloupka via Digitalmars-d-learn
Hi, we're using vibe-d (on Linux) for a long running REST API server and have problem with constantly growing memory until system kills it with OOM killer. First guess was some memory leak so we've added periodic call to: ```D GC.collect(); GC.minimize(); malloc_trim(0); ``` And when called

Error when running dmd compilable tests

2021-04-11 Thread Per Nordlöw via Digitalmars-d-learn
Inside dmd source tree, under sub-directory test, I do ./run.d compilable/ . This errors as ``` ... compilable/json.d -d -preview=dip1000 -o- -X -Xf/home/per/Work/dmd/test/test_results/compilable/json.out -fPIC ()== Test 'compilable/json.d'

Re: GC memory fragmentation

2021-04-11 Thread ryuukk_ via Digitalmars-d-learn
On Sunday, 11 April 2021 at 13:50:12 UTC, tchaloupka wrote: On Sunday, 11 April 2021 at 12:20:39 UTC, Nathan S. wrote: One thing that comes to mind: is your application compiled as 32-bit? The garbage collector is much more likely to leak memory with a 32-bit address space since it much more

Re: GC memory fragmentation

2021-04-11 Thread ryuukk_ via Digitalmars-d-learn
I should have added https://dub.pm/package-format-json#build-types profileGC as build option in your dub file That will generate a profile_gc file once the program exit, a table that lists all the allocations

Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
So, here is the full code: ```d enum Color {none=0,red=1,black=2}; enum sColor {black=0,white=1}; class Square { public: this(Color color, sColor Scolor) { this.color = color; this.Scolor = Scolor; } Color color; sColor Scolor; } import std.stdio; void

Re: Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new Square(Color.none, sColor.white); ```

How to use a shared library created in cython?

2021-04-11 Thread affonso elias ferreira junior via Digitalmars-d-learn
Hi everyone, I'm trying to use a shared library created in Cython. example. *file run_cython.pyx** cpdef int test(int x): cdef int y = 1 cdef int i for i in range(1, x+1): y *= i return y

Re: Range Error

2021-04-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i < 0`.

Re: Is there a more elegant way to do this in D?

2021-04-11 Thread Q. Schroll via Digitalmars-d-learn
On Thursday, 8 April 2021 at 18:06:25 UTC, Meta wrote: On Thursday, 8 April 2021 at 18:01:56 UTC, Meta wrote: On Thursday, 8 April 2021 at 12:19:29 UTC, WebFreak001 wrote: ```d string to01String(int[] x) @safe { auto conv = x.to!(ubyte[]); // allocates new array, so later cast to string

"this" as default parameter for a constructor.

2021-04-11 Thread Pierre via Digitalmars-d-learn
Hi, I have a class with a reference to the parent object and a constructor that has the parent as parameter class foo { this ( foo p /* , other params */ ) { parent = p; } foo parent; } Of cause, the parent is almost always the object that creates the