Re: scope(exit) & stack => double free or corruption (fasttop) ... help?

2013-02-24 Thread H. S. Teoh
On Sun, Feb 24, 2013 at 03:14:01PM -0800, Charles Hixson wrote: > Given a struct with: > > ~this() > { close(); } > > void close() > { if (currentKey !is null) currentKey = null; >if (cursor is null)return; >tcbdbcurdel(cursor); > } > > and: > > scope (exit)

scope(exit) & stack => double free or corruption (fasttop) ... help?

2013-02-24 Thread Charles Hixson
Given a struct with: ~this() { close(); } voidclose() { if (currentKey !is null) currentKey = null; if (cursor is null)return; tcbdbcurdel(cursor); } and: scope (exit) if (bdb !is null) tcbdbclose(bdb); //scope(exit) cur.close; // <<- cur

Re: Difference between DList and SList from garbage collector point of view

2013-02-24 Thread monarch_dodra
On Sunday, 24 February 2013 at 20:16:26 UTC, Alexandr Druzhinin wrote: I used in my application DList (code is large and I couldn't reduce it) and the application allocates memory always. I can not realize why and don't know it now. But when I replaced DList by SList (and even dynamic array) me

Difference between DList and SList from garbage collector point of view

2013-02-24 Thread Alexandr Druzhinin
I used in my application DList (code is large and I couldn't reduce it) and the application allocates memory always. I can not realize why and don't know it now. But when I replaced DList by SList (and even dynamic array) memory leaks disappeared at all and all works as expected. I know it is h

Re: std.signal woes :/

2013-02-24 Thread cal
On Sunday, 24 February 2013 at 17:30:14 UTC, Damian wrote: That solution is ok for 1 argument but for many arguments it wont suffice. This is issue 5028. What is the problem with many arguments? I'm probably misunderstanding, but e.g. this works: struct MySignal(T...) { mixin Signal!T

Re: What does this compile-time error mean?

2013-02-24 Thread Jonathan M Davis
On Sunday, February 24, 2013 14:05:26 Timon Gehr wrote: > On 02/24/2013 01:59 PM, Maxim Fomin wrote: > > On Sunday, 24 February 2013 at 09:00:17 UTC, Jonathan M Davis wrote: > >> Because main_cont is module-level variable, it must be initialized with a > >> value at compile time. Classes can be use

Re: Error using `equal` with various string types

2013-02-24 Thread Jonathan M Davis
On Sunday, February 24, 2013 13:02:46 monarch_dodra wrote: > My first reaction when I stumbled upon it actually. Then again, > can't the same be said about lambas? Technically, they *are* > templates, since the type is determined when they are actually > called. > > Also, when you say "alias", do

Re: Error using `equal` with various string types

2013-02-24 Thread Andrej Mitrovic
On 2/24/13, Jonathan M Davis wrote: > Those _do_ work. The problem is that you're not trying that; you're trying > ["foo"].equal(["foo"d]); Ah that makes sense, thanks. A run of the mill implementation takes care of things: bool equal(Range1, Range2)(Range1 r1, Range2 r2) if (isInputRange!R

Re: std.signal woes :/

2013-02-24 Thread Damian
On Saturday, 23 February 2013 at 23:39:19 UTC, cal wrote: On Saturday, 23 February 2013 at 17:01:48 UTC, Damian wrote: Ok signals work fine, until I use them in a descendant class. Snippet: - import std.signals; class ClassA { public mixin Signal!(int) addNumber1; } cl

Re: About GC

2013-02-24 Thread Alexandr Druzhinin
24.02.2013 23:28, Ali Çehreli пишет: On 02/24/2013 06:26 AM, Alexandr Druzhinin wrote: > In the following code http://dpaste.dzfl.pl/f4ae16aa > memory consumption depends on DATA_SIZE value. Bigger value bigger > consumption - it's natural. Consumption starts from some value and > continue to

Re: About GC

2013-02-24 Thread Ali Çehreli
On 02/24/2013 06:26 AM, Alexandr Druzhinin wrote: > In the following code http://dpaste.dzfl.pl/f4ae16aa > memory consumption depends on DATA_SIZE value. Bigger value bigger > consumption - it's natural. Consumption starts from some value and > continue to some threshold. After reachin this thresh

Re: About GC

2013-02-24 Thread Alexandr Druzhinin
24.02.2013 21:26, Alexandr Druzhinin пишет: In the following code http://dpaste.dzfl.pl/f4ae16aa memory consumption depends on DATA_SIZE value. Bigger value bigger consumption - it's natural. Consumption starts from some value and continue to some threshold. After reachin this threshold comsumpti

Re: About GC

2013-02-24 Thread Alexandr Druzhinin
24.02.2013 21:26, Alexandr Druzhinin пишет: In the following code http://dpaste.dzfl.pl/f4ae16aa memory consumption depends on DATA_SIZE value. Bigger value bigger consumption - it's natural. Consumption starts from some value and continue to some threshold. After reachin this threshold comsumpti

About GC

2013-02-24 Thread Alexandr Druzhinin
In the following code http://dpaste.dzfl.pl/f4ae16aa memory consumption depends on DATA_SIZE value. Bigger value bigger consumption - it's natural. Consumption starts from some value and continue to some threshold. After reachin this threshold comsumption doesn't enlarge. This threshold depends

Re: What does this compile-time error mean?

2013-02-24 Thread Timon Gehr
On 02/24/2013 01:59 PM, Maxim Fomin wrote: On Sunday, 24 February 2013 at 09:00:17 UTC, Jonathan M Davis wrote: Because main_cont is module-level variable, it must be initialized with a value at compile time. Classes can be used at compile time (at least some of the time), but they cannot stick

Re: What does this compile-time error mean?

2013-02-24 Thread Maxim Fomin
On Sunday, 24 February 2013 at 09:00:17 UTC, Jonathan M Davis wrote: Because main_cont is module-level variable, it must be initialized with a value at compile time. Classes can be used at compile time (at least some of the time), but they cannot stick around between compile time and runtime, m

Re: What does this compile-time error mean?

2013-02-24 Thread Alexandr Druzhinin
24.02.2013 15:59, Jonathan M Davis пишет: Because main_cont is module-level variable, it must be initialized with a value at compile time. Classes can be used at compile time (at least some of the time), but they cannot stick around between compile time and runtime, meaning that you could potent

Re: Error using `equal` with various string types

2013-02-24 Thread monarch_dodra
On Sunday, 24 February 2013 at 11:35:28 UTC, Jonathan M Davis wrote: On Sunday, February 24, 2013 12:24:21 monarch_dodra wrote: On Sunday, 24 February 2013 at 04:47:41 UTC, Jonathan M Davis wrote: > However, now that I think about it, equal takes a predicate, > so > it would > probably work t

Re: Error using `equal` with various string types

2013-02-24 Thread Jonathan M Davis
On Sunday, February 24, 2013 12:24:21 monarch_dodra wrote: > On Sunday, 24 February 2013 at 04:47:41 UTC, Jonathan M Davis > > wrote: > > However, now that I think about it, equal takes a predicate, so > > it would > > probably work to do something like > > > > equal!"equal(a, b)"(["hello"d], ["h

Re: Error using `equal` with various string types

2013-02-24 Thread monarch_dodra
On Sunday, 24 February 2013 at 04:47:41 UTC, Jonathan M Davis wrote: However, now that I think about it, equal takes a predicate, so it would probably work to do something like equal!"equal(a, b)"(["hello"d], ["hello"]); - Jonathan M Davis Yes, and you don't even need to use a mixin. This i

Re: What does this compile-time error mean?

2013-02-24 Thread Jonathan M Davis
On Sunday, February 24, 2013 15:42:33 Alexandr Druzhinin wrote: > This code: > > import std.stdio; > import std.container; > import std.range; > > auto main_cont = redBlackTree(iota(0, 100, 10).array); > > void main() { > > writeln(main_cont.array); > } > > at compilation with dmd 2.062 ge

What does this compile-time error mean?

2013-02-24 Thread Alexandr Druzhinin
This code: import std.stdio; import std.container; import std.range; auto main_cont = redBlackTree(iota(0, 100, 10).array); void main() { writeln(main_cont.array); } at compilation with dmd 2.062 generates: D:\applications\D\dmd2\windows\bin\..\..\src\druntime\import\core\memory.d(316):