Re: Error: out of memory
On Saturday, 18 March 2017 at 20:39:20 UTC, StarGrazer wrote: I have some CTFE's and meta programming that cause dmd to run out of memory ;/ I am generating simple classes, but a lot of them. dmd uses about 2GB before it quits. It also only uses about 12% of cpu. I've noticed heavy use of foreach and temporary variables will end up wiping out a lot of your memory using CTFE... At which point using a different for loop might be a better idea.
Re: std.digest toHexString
On Thursday, 16 March 2017 at 16:13:33 UTC, Carl Sturtivant wrote: What's going on here? Looks like this bug: https://issues.dlang.org/show_bug.cgi?id=9279 Has it not been fixed?
Re: exceptions thrown when running app with failed unittests
On Sunday, 19 March 2017 at 23:23:48 UTC, Adam D. Ruppe wrote: On Sunday, 19 March 2017 at 22:33:26 UTC, Ervin Bosenbacher wrote: Is it normal to see the long trace output instead of just a failed unit test message? Yeah, it is normal, though IMO useless and ought to just be removed (or at least shortened to just the top few lines). Thx Adam.
Re: exceptions thrown when running app with failed unittests
On Sunday, 19 March 2017 at 22:33:26 UTC, Ervin Bosenbacher wrote: Is it normal to see the long trace output instead of just a failed unit test message? Yeah, it is normal, though IMO useless and ought to just be removed (or at least shortened to just the top few lines).
Re: exceptions thrown when running app with failed unittests
On Sunday, 19 March 2017 at 22:33:26 UTC, Ervin Bosenbacher wrote: On Sunday, 19 March 2017 at 22:20:58 UTC, cym13 wrote: On Sunday, 19 March 2017 at 22:13:21 UTC, Ervin Bosenbacher wrote: Its my 2nd day into D, I am already in deep love (:D), and I would like to understand whether this is normal behavior or something went terribly wrong, so all help is greatly appreciated. [...] Well, unittests can pass or fail and as the exception states there it failed. Binary search returns true if it found the element in the array, false otherwise. 5 is not an element of [1, 3, 6, 7, 9, 15] so binarySearch returned false. Assert throws an error if its argument is false to it threw. Nothing out of the ordinary except maybe a broken test. Thank you :) Maybe I need to rephrase. Is it normal to see the long trace output instead of just a failed unit test message? If someone can just give me more clarifications that would be greatly appreciated. (For some reason I did not think that to see the stack trace is normal)
Re: Error: out of memory
On Saturday, 18 March 2017 at 20:39:20 UTC, StarGrazer wrote: I have some CTFE's and meta programming that cause dmd to run out of memory ;/ I am generating simple classes, but a lot of them. dmd uses about 2GB before it quites. It also only uses about 12% of cpu. I have 16 GB total memory and about that free. Surely dmd could do a better job? Any way to get it to do such a thing like set the maximum amount of memory it can use? Can you submit this code for analysis ?
Re: Error: out of memory
On Sunday, 19 March 2017 at 20:50:50 UTC, Gand Alf wrote: just use DMD with the -m64 parameter ;) then you should get a x64 DMD No, at least afaik, then you tell DMD to make a x64 exe, but DMD itself (this particular Windows version) is still a 32-bit exe.
Re: exceptions thrown when running app with failed unittests
On Sunday, 19 March 2017 at 22:20:58 UTC, cym13 wrote: On Sunday, 19 March 2017 at 22:13:21 UTC, Ervin Bosenbacher wrote: Its my 2nd day into D, I am already in deep love (:D), and I would like to understand whether this is normal behavior or something went terribly wrong, so all help is greatly appreciated. [...] Well, unittests can pass or fail and as the exception states there it failed. Binary search returns true if it found the element in the array, false otherwise. 5 is not an element of [1, 3, 6, 7, 9, 15] so binarySearch returned false. Assert throws an error if its argument is false to it threw. Nothing out of the ordinary except maybe a broken test. Thank you :) Maybe I need to rephrase. Is it normal to see the long trace output instead of just a failed unit test message?
Re: exceptions thrown when running app with failed unittests
On 03/19/2017 03:13 PM, Ervin Bosenbacher wrote: > Its my 2nd day into D, I am already in deep love (:D), and I would like > to understand whether this is normal behavior or something went terribly > wrong, so all help is greatly appreciated. > > Following the book of The D Programming language I have the code below: > > bool binarySearch(T)(T[] input, T value) { > while (!input.empty) { > auto i = input.length / 2; > auto mid = input[i]; > if (mid > value) input = input[0 .. i]; > else if (mid < value) input = input[i + 1 .. $]; > else return true; > } > return false; > } > > @safe nothrow unittest { > assert(binarySearch([ 1, 3, 6, 7, 9, 15 ], 6)); That should return true and the assertion will pass. > assert(binarySearch([ 1, 3, 6, 7, 9, 15 ], 5)); Since there is no 5 in the array, that will return false and the assertion will fail, which means that the tests failed. > } > > void main() { > > bool s1 = binarySearch([1, 3, 6, 7, 9, 15], 6); > bool s2 = binarySearch!(int)([1, 3, 6, 7, 9, 15], 5); > writeln(s1, s2); > } > > Then I compile using the command > $ dmd source/app.d -unittest > > and execute as follows > $ ./app So, effectively you requested a unit test run and it failed. > > Then the output > core.exception.AssertError@source/app.d(62): unittest failure > Unless I'm missing something in your question, that's exactly the expected outcome. :) Ali
Re: exceptions thrown when running app with failed unittests
On Sunday, 19 March 2017 at 22:13:21 UTC, Ervin Bosenbacher wrote: Its my 2nd day into D, I am already in deep love (:D), and I would like to understand whether this is normal behavior or something went terribly wrong, so all help is greatly appreciated. [...] Well, unittests can pass or fail and as the exception states there it failed. Binary search returns true if it found the element in the array, false otherwise. 5 is not an element of [1, 3, 6, 7, 9, 15] so binarySearch returned false. Assert throws an error if its argument is false to it threw. Nothing out of the ordinary except maybe a broken test.
exceptions thrown when running app with failed unittests
Its my 2nd day into D, I am already in deep love (:D), and I would like to understand whether this is normal behavior or something went terribly wrong, so all help is greatly appreciated. Following the book of The D Programming language I have the code below: bool binarySearch(T)(T[] input, T value) { while (!input.empty) { auto i = input.length / 2; auto mid = input[i]; if (mid > value) input = input[0 .. i]; else if (mid < value) input = input[i + 1 .. $]; else return true; } return false; } @safe nothrow unittest { assert(binarySearch([ 1, 3, 6, 7, 9, 15 ], 6)); assert(binarySearch([ 1, 3, 6, 7, 9, 15 ], 5)); } void main() { bool s1 = binarySearch([1, 3, 6, 7, 9, 15], 6); bool s2 = binarySearch!(int)([1, 3, 6, 7, 9, 15], 5); writeln(s1, s2); } Then I compile using the command $ dmd source/app.d -unittest and execute as follows $ ./app Then the output core.exception.AssertError@source/app.d(62): unittest failure 4 app 0x00010b18d1d0 _d_unittest + 152 5 app 0x00010b183d1e void app.__unittest_fail(int) + 38 6 app 0x00010b183df4 nothrow @safe void app.__unittestL60_1() + 184 7 app 0x00010b183ca0 void app.__modtest() + 8 8 app 0x00010b18db54 int core.runtime.runModuleUnitTests().__foreachbody2(object.ModuleInfo*) + 44 9 app 0x00010b186656 int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*)) + 34 10 app 0x00010b1a4471 int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref rt.sections_osx_x86_64.SectionGroup) + 85 11 app 0x00010b1a43fc int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))) + 32 12 app 0x00010b18662d int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)) + 33 13 app 0x00010b18da3e runModuleUnitTests + 126 14 app 0x00010b19e312 void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll() + 22 15 app 0x00010b19e2ab void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate()) + 31 16 app 0x00010b19e21e _d_run_main + 458 17 app 0x00010b183d37 main + 15 18 libdyld.dylib 0x7fff95f2d254 start + 0 19 ??? 0x 0x0 + 0 The compiles is DMD64 D Compiler v2.073.1 Copyright (c) 1999-2016 by Digital Mars written by Walter Bright and I am executing this on OSX 10.12
Re: Inplace toLower()
On 03/19/2017 10:32 PM, Nordlöw wrote: Is there an in-place version of std.uni.toLower() toLowerInPlace
Re: GitHub detects .d source as Makefile?
On Saturday, 18 March 2017 at 01:33:13 UTC, David Nadlinger wrote: On Saturday, 18 March 2017 at 00:34:57 UTC, XavierAP wrote: Is this a known issue with D on GitHub? Should I report it I guess? How smart is GH that it doesn't look at the file extension? What happened? The extension .d can legitimately refer to makefiles as well (specifically, to dependency files). The code GitHub uses to infer source file languages is open-source, and – fittingly – available on GitHub: https://github.com/github/linguist You should check the issues for reports of similar D-related problems, and if there are none, create a new one. Or, better yet, submit a pull request with an appropriate fix. As a workaround, adding a "module …;" declaration to your file should help. You probably want to be doing that anyway. — David FWIW this has been fixed by Martin last summer, but the people at GitHub aren't very responsive. The PR is still pending :/ More info: https://trello.com/c/g9PB3ISG/233-improve-d-language-recognition-on-github https://github.com/github/linguist/pull/3145
Inplace toLower()
Is there an in-place version of std.uni.toLower() If not, how do I most elegantly construct one?
Re: Error: out of memory
On Sunday, 19 March 2017 at 20:49:02 UTC, Gand Alf wrote: On Saturday, 18 March 2017 at 23:24:40 UTC, kinke wrote: The Win64 LDC releases [https://github.com/ldc-developers/ldc/releases] feature a 64-bit compiler. just use DMD with the -m64 parameter ;) then you should get a x64 DMD
Re: Error: out of memory
On Saturday, 18 March 2017 at 23:24:40 UTC, kinke wrote: The Win64 LDC releases [https://github.com/ldc-developers/ldc/releases] feature a 64-bit compiler. just use DMD with the -m64 parameter ;)
Re: 'Access Violation Error' with parallel-foreach loop
On Sunday, 19 March 2017 at 00:46:29 UTC, ooyu wrote: On Saturday, 18 March 2017 at 22:27:27 UTC, Vladimir Panteleev wrote: [...] Aha! Thank you. I try again using std.file.write and input ubyte[] data. auto rq = Request(); auto d = rq.get( std.uri.encode(web_url) ); std.file.write(path_hash[web_url], d.responseBody.data); working pretty :-) It would be nice to know what actually solved problem.
Re: What is PostgreSQL driver is most stable?
On Wednesday, 15 March 2017 at 08:54:59 UTC, Paolo Invernizzi wrote: I'm curious: ddb does not support yet arbitrary precision numbers [1], does dpq support them? Does Dlang supports them?