Re: double free or corruption error when using parallel foreach
On 2012-12-28 01:08, Minas Mina wrote: Note that there is more code after bool hit = ... but I didn't include it because the problem is in the trace function (I commented it out and everything else worked -- apart from the things are dependent on it of course) Why don't you show the trace function then? Where's the rest of the code? [xcb] Unknown request in queue while dequeuing [xcb] Most likely this is a multi-threaded client and XInitThreads has not been called [xcb] Aborting, sorry about that. raytracing: ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed. bash: line 1: 18982 Aborted (core dumped) /home/minas/Projects/D/raytracing/raytracing/bin/Release/raytracing This sheds some light on the problem. Probably it would go away if only a single thread was made responsible for calls into libxcb. That's a preferable, safer approach than initializing for multi-threading (but have you done the initializing?). double free or corruption IMO that's just a consequence of several threads manipulating same data without any locks or synchronization in place.
Re: Running out of memory
On 2012-12-28 05:41, Jonathan M Davis wrote: The idea is that if you want to be manually freeing memory, you shouldn't be using GC memory in the first place. It's unsafe to be freeing it. Let the GC do that. If you want to manually manage memory, then manually manage it with malloc and free. If you really need to, then core.memory has the functions for managing the GC's memory, but you really shouldn't be doing that normally. I don't require manual malloc. I wanted to make a hint to the GC, that this block can be freed, because I know there are no other pointers into it (that would be used later), while the imprecise GC finds false pointers and prevents the block from being released. Of course delete is not safe in general, but if the program is designed to process data in completely isolated batches, then it shouldn't pose a threat.
Re: Running out of memory
On Friday, 28 December 2012 at 10:40:32 UTC, FG wrote: I don't require manual malloc. I wanted to make a hint to the GC, that this block can be freed, because I know there are no other pointers into it (that would be used later), while the imprecise GC finds false pointers and prevents the block from being released. set to null + GC.collect()? but of course it shouldn't be used careless too
Re: structs are now lvalues - what is with auto ref?
In consideration that Andrei said that the implementation of auto ref for none-template functions are relatively easy and that until now only the first beta of 2.061 came out: How likely is it that auto ref will implemented in this release? Maybe an official statement would be good. Purely out of interest, because only then this release would really be useful for me (and maybe even for other). But of course I know, that I am completely irrelevant. ;)
Re: structs are now lvalues - what is with auto ref?
Namespace: How likely is it that auto ref will implemented in this release? Walter wants to release 2.061 soon. So maybe that's for the successive (unstable?) version of the compiler. Bye, bearophile
Re: structs are now lvalues - what is with auto ref?
On Friday, 28 December 2012 at 12:28:01 UTC, bearophile wrote: Namespace: How likely is it that auto ref will implemented in this release? Walter wants to release 2.061 soon. So maybe that's for the successive (unstable?) version of the compiler. Bye, bearophile As long as it is implemented soon, I'm so satisfied. But an official statement that it will be implemented soon, would be nice. This feature is really very important and useful.
Re: Using multiple processors
On Thu, 2012-12-27 at 13:39 -0500, n00b wrote: Le 24/12/2012 05:18, thedeemon a écrit : On Sunday, 23 December 2012 at 08:00:56 UTC, n00b wrote: Hello. My program has a great deal of computation to do, so I thought I'd create several threads in order to use multiple processors. It worked fine with a simple test program, but when I try to do this with the real program, only 1 processor is used. How much memory allocation is happening there? High allocation rate and often GCs can kill parallelism since they're happening with a lock. Anyway, too hard to tell anything certain without knowing what your program is doing. I tried to disable GC and reduce memory allocation. It didn't work but I guess allocation rate is still pretty high, I'll try to reduce it even more, and post more details if it still doesn't work. Thanks for your answer. Simply creating threads to try and harness parallelism is generally the wrong approach. Multi-threading should be treated as infrastructure, in the same way stack and heap are. Most programmers (unless they are severely resource constrained) never need to worry about stack and heap management, they leave it to the compiler and runtime system. Threads should be treated the exact same way, they are infrastructure to be managed by the runtime system. Use a higher level parallelism model such as actors (cf. D's spawn), dataflow (I think D has no offering here yet), CSP (D definitely doesn't have an offering here as yet, even though Go does), data parallelism (D's std.parallelism is your friend here). Map your solution to your problem to one of these models and you harness thread pools that manage the threads for you. This way you do not have to manage locks, semaphores, monitors, etc. all of which are tools required for operating systems or writing actor, dataflow, CSP, data parallelism, agents, etc. toolkits. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: structs are now lvalues - what is with auto ref?
On Friday, 28 December 2012 at 12:47:03 UTC, Namespace wrote: On Friday, 28 December 2012 at 12:28:01 UTC, bearophile wrote: Namespace: How likely is it that auto ref will implemented in this release? Walter wants to release 2.061 soon. So maybe that's for the successive (unstable?) version of the compiler. Bye, bearophile As long as it is implemented soon, I'm so satisfied. But an official statement that it will be implemented soon, would be nice. This feature is really very important and useful. +1
checking whether the number is NaN
Hi! Tell me please,are there any way to check whether number is NaN?
Re: checking whether the number is NaN
On Friday, 28 December 2012 at 15:59:35 UTC, bearophile wrote: Zhenya: Tell me please,are there any way to check whether number is NaN? http://dlang.org/phobos/std_math.html#isNaN Bye, bearophile Thank you!
Re: checking whether the number is NaN
Tell me please,are there any way to check whether number is NaN? http://dlang.org/phobos/std_math.html#isNaN pure nothrow @trusted bool isNaN(real x); Returns !=0 if e is a NaN. --- Seems like a slight documentation disagreement. Shows bool prototype but description says returns !=0
Re: structs are now lvalues - what is with auto ref?
I wrote a workaround for me: I implement it in Romulus. So for these functions: [code] void foo(auto ref const Foo f) { // do something with f } const(int[42]) bar(auto ref const Foo a, auto ref const Foo b) pure nothrow { // do something with a and b } const(int[42]) quatz(auto ref const Foo a, auto ref const Foo b, auto ref const Foo c) pure nothrow { // do something with a and b } [/code] Romulus generates (if they aren't template functions): [code] void foo( const Foo f){ return foo(f); } void foo(ref const Foo f) { // do something with f } const(int[42]) bar(ref const Foo a, const Foo b)) pure nothrow{ return bar(a,b); } const(int[42]) bar(const Foo a, ref const Foo b)) pure nothrow{ return bar(a,b); } const(int[42]) bar( const Foo a, const Foo b) pure nothrow{ return bar(a,b); } const(int[42]) bar(ref const Foo a, ref const Foo b) pure nothrow { // do something with a and b } const(int[42]) quatz(ref const Foo a, const Foo b, const Foo c)) pure nothrow{ return quatz(a,b,c); } const(int[42]) quatz(const Foo a, ref const Foo b, const Foo c)) pure nothrow{ return quatz(a,b,c); } const(int[42]) quatz(const Foo a, const Foo b, ref const Foo c)) pure nothrow{ return quatz(a,b,c); } const(int[42]) quatz(ref const Foo a, ref const Foo b, const Foo c)) pure nothrow{ return quatz(a,b,c); } const(int[42]) quatz(const Foo a, ref const Foo b, ref const Foo c)) pure nothrow{ return quatz(a,b,c); } const(int[42]) quatz(ref const Foo a, const Foo b, ref const Foo c)) pure nothrow{ return quatz(a,b,c); } const(int[42]) quatz( const Foo a, const Foo b, const Foo c) pure nothrow{ return quatz(a,b,c); } const(int[42]) quatz(ref const Foo a, ref const Foo b, ref const Foo c) pure nothrow { // do something with a and b } [/code] I will push it later on my github account. Maybe someone like it.
ELF interpreter /libexec/ld-elf.so.1 not found
I am attempting to install DMD on BSD and a running into some issues. The first issue is that there is no dmd.conf file bundled in freebsd/bin32. I mirrored the content of /osx/bin/dmd.conf but am not sure if there is anything unique to FREEBSD or some other BSD flavor that needs to be in this file. The other problem is that I keep getting the error: ELF interpreter /libexec/ld-elf.so.1 not found on my system this files is actually in /usr/libexec/ld-elf.so.1. What do I need to configure so that DMD will find it? Thanks in advance. Andrew
Re: checking whether the number is NaN
On 2012-42-28 16:12, Zhenya zh...@list.ru wrote: Hi! Tell me please,are there any way to check whether number is NaN? us std.math.isNaN. But if you really don't want to: float x = ...; if (x != x) { writeln( x is NaN ); } I'm unsure how aggressive the optimizer is allowed to be in cases like this. Theoretically it could assume x is always equal to x, but I'd think it's not allowed to for floats. If you're wondering how a float value could compare different to the exact same value, consider that this would otherwise be true: sqrt(-1) == 0/0 -- Simen
Re: ELF interpreter /libexec/ld-elf.so.1 not found
When I used dmd on bsd, I just recompiled it from source. cd dmd2/src/dmd make -f posix.mak cp dmd ../../freebsd/bin32 and then you can use it from in there.
Re: structs are now lvalues - what is with auto ref?
On Friday, December 28, 2012 13:19:01 Namespace wrote: In consideration that Andrei said that the implementation of auto ref for none-template functions are relatively easy and that until now only the first beta of 2.061 came out: How likely is it that auto ref will implemented in this release? Maybe an official statement would be good. Purely out of interest, because only then this release would really be useful for me (and maybe even for other). But of course I know, that I am completely irrelevant. ;) 2.061 is beta. I think that the chances of it having something like this in it are very close to zero. - Jonathan M Davis
Re: structs are now lvalues - what is with auto ref?
2.061 is beta. I think that the chances of it having something like this in it are very close to zero. - Jonathan M Davis You know how to give a suffering hope. :D
Re: structs are now lvalues - what is with auto ref?
On Friday, December 28, 2012 22:21:09 Namespace wrote: 2.061 is beta. I think that the chances of it having something like this in it are very close to zero. - Jonathan M Davis You know how to give a suffering hope. :D LOL. Yeah, well. It's not like I'm going to lie about it. I'd love to see this fixed as well, but I can't change reality, and I have lots of other stuff that I need to do (much of which is Phobos-related) and not enough time to do it, so I'm not going to spend the time figuring out enough about the compiler to implement it myself. And the reality of the matter is that even if someone implemented it right now, it's unlikely that it would end up in the next release of the compiler, because it's now in beta. The chances aren't necessarily zero, but they're pretty low, and since no one shows any signs of implementing it right now AFAIK, that pretty much puts the chances at zero. - Jonathan M Davis
Re: structs are now lvalues - what is with auto ref?
Spontaneous question: why was the behavior altered from lvalue to rvalue if there is still no replacement with auto ref and so a lot of code becomes invalid? I know of course that the change was necessary, but as long as there is no fix I don't understand such ruthless change. It meant no offense, I'm just curious.
GtkD - missing DLLs in Gtk win32 runtime
I'm trying out the latest GtkD binding. The lib has built without problems, some example programs also compile, but I can't run them. The Gtk-Runtime-3.6 archive provided at https://github.com/gtkd-developers/GtkD/downloads is missing several win32 DLL libraries: LIBRARY.GLGDK: libgdkglext-win32-3.0-0.dll, LIBRARY.GLGTK: libgtkglext-win32-3.0-0.dll, LIBRARY.GDA: libgda-4.0-4.dll, LIBRARY.GSV: libgtksourceview-3.0-0.dll, LIBRARY.GSTREAMER: libgstreamer-0.10.dll, LIBRARY.GSTINTERFACES: libgstinterfaces-0.10.dll I found four of them on the net but can't locate these two anywhere: libgdkglext-win32-3.0-0.dll and libgtkglext-win32-3.0-0.dll Please help.
Re: structs are now lvalues - what is with auto ref?
On Friday, December 28, 2012 23:29:38 Namespace wrote: Spontaneous question: why was the behavior altered from lvalue to rvalue if there is still no replacement with auto ref and so a lot of code becomes invalid? I know of course that the change was necessary, but as long as there is no fix I don't understand such ruthless change. It meant no offense, I'm just curious. Because the code was invalid to begin with. It was a bug that it was ever allowed. Not fixing it would just encourage people to continue writing incorrect code and thus break even more code later. And it's not like the functions that currently work with ref or const ref are going to later when the auto ref situation is sorted out, since it's almost certain that that will be solved with auto ref and not by changing anything with ref or const ref. Also, there's the cost in confusion caused by allowing foo(S(5)) but not foo(bar()). So, in some ways, allowing the broken behavior actually causes more problems than fixing it does. - Jonathan M Davis
Re: GtkD - missing DLLs in Gtk win32 runtime
On Saturday, 29 December 2012 at 00:46:15 UTC, FG wrote: I'm trying out the latest GtkD binding. The lib has built without problems, some example programs also compile, but I can't run them. The Gtk-Runtime-3.6 archive provided at https://github.com/gtkd-developers/GtkD/downloads is missing several win32 DLL libraries: LIBRARY.GLGDK: libgdkglext-win32-3.0-0.dll, LIBRARY.GLGTK: libgtkglext-win32-3.0-0.dll, LIBRARY.GDA: libgda-4.0-4.dll, LIBRARY.GSV: libgtksourceview-3.0-0.dll, LIBRARY.GSTREAMER: libgstreamer-0.10.dll, LIBRARY.GSTINTERFACES: libgstinterfaces-0.10.dll I found four of them on the net but can't locate these two anywhere: libgdkglext-win32-3.0-0.dll and libgtkglext-win32-3.0-0.dll Please help. isn't it gtk stuff? i mean you may be need to build it(gtk3) yourself since there is no official gtk3 binaries for windows(and osx too)
Re: detecting POD types
On Sunday, 20 May 2012 at 13:50:17 UTC, japplegame wrote: I write function template that should works only with POD types (i.e. base types, structures, enums etc.). Is there something like C++11 std::is_pod (http://en.cppreference.com/w/cpp/types/is_pod) template? Sorry for resurrecting this old thread, but: What is your definition of plain old data? The D language doesn't have one. David