std.container.Array/RefCounted(T) leaking memory?

2011-01-07 Thread %u
Hi, This code seems to leak memory, as the memory isn't reclaimed: //Test memory here: low { auto b = Array!(bool)(); b.length = 1024 * 1024 * 128 * 8; //Test memory here: high } //Test memory here: high Am I missing something about how Array(T) (and RefCounted) works, or

Re: D Language info collected and combined into one CHM file.

2011-01-07 Thread david wang
Great! Thank you. Please view the download link: https://docs.google.com/leaf?id=0B38se3xzJrbuMjNlMTQ5MzUtYTM1NC00M2UyLWJjODctMDZlM2Y2ZWQwYjlm&hl=en&authkey=CPvh1ZoG (if you can not see the page correctly shown, just refresh the page) this "D_Language.chm" was produced yesterday and collected t

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> First, you should understand that the GC does not know what data is in a > memory block. That is exactly why I was wondering how it figures things out. :) > Data *allocated* as a void[] (which I highly recommend *not* doing) will be conservatively marked as containing pointers. Ah, all right

Re: auto declarations

2011-01-07 Thread Jonathan M Davis
On Friday, January 07, 2011 13:32:42 Ellery Newcomer wrote: > auto a = 1, b = null; > > int a = 1, *b = null; > > > The first is accepted by dmd, and it should result in typeof(a) == int > and typeof(b) == void*. It is somewhat contradictory to the error > message resulting from the second: > >

Re: How the GC distinguishes code from data

2011-01-07 Thread Steven Schveighoffer
On Fri, 07 Jan 2011 16:39:20 -0500, %u wrote: None what so ever. Huh.. then what about what is said in this link? http://d.puremagic.com/issues/show_bug.cgi?id=5326#c1 I was told that void[] could contain references, but that ubyte[] would not, and that the GC would need to scan the former

Re: auto declarations

2011-01-07 Thread Piotr Szturmaj
Ellery Newcomer wrote: auto a = 1, b = null; int a = 1, *b = null; The first is accepted by dmd, and it should result in typeof(a) == int and typeof(b) == void*. It is somewhat contradictory to the error message resulting from the second: multiple declarations must have the same type, not in

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> None what so ever. Huh.. then what about what is said in this link? http://d.puremagic.com/issues/show_bug.cgi?id=5326#c1 I was told that void[] could contain references, but that ubyte[] would not, and that the GC would need to scan the former but not the latter. Is that wrong? Thank you!

auto declarations

2011-01-07 Thread Ellery Newcomer
auto a = 1, b = null; int a = 1, *b = null; The first is accepted by dmd, and it should result in typeof(a) == int and typeof(b) == void*. It is somewhat contradictory to the error message resulting from the second: multiple declarations must have the same type, not int and int* I am skep

Re: How the GC distinguishes code from data

2011-01-07 Thread Simen kjaeraas
%u wrote: You have to add it to the garbage collector's list of roots But if I need to do that, then what would be the difference between void[] and ubyte[]? None what so ever. If you want to mark some memory with special bits, use setattr in core.memory. -- Simen

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> Kinda sorta. I haven't had any problems from that. If you allocate very large blocks in the garbage collector you may face trouble :-) Haha okay, thanks. :) (This makes me shiver quite a bit...) > You have to add it to the garbage collector's list of roots But if I need to do that, then what

Re: D Language info collected and combined into one CHM file.

2011-01-07 Thread Jimmy Cao
Maybe it's too big. Just post a download link.

Re: How the GC distinguishes code from data

2011-01-07 Thread Pelle
On 01/07/2011 06:47 PM, %u wrote: It assumes everything on the stack is pointers, at the moment, I believe Uh-oh... not the answer I wanted to hear, but I was half-expecting this. So doesn't that mean that, at the moment, D will leak memory? Kinda sorta. I haven't had any problems from that.

Re: Threads, shread and TLS

2011-01-07 Thread Steven Schveighoffer
On Fri, 07 Jan 2011 11:30:17 -0500, Adam Conner-Sax wrote: Thanks! It's not really about correctness as much as trying to understand how these different storage classes work. I understand that there is only one foo object. I wanted to see which parts are thread-local and which are share

Re: How the GC distinguishes code from data

2011-01-07 Thread %u
> It assumes everything on the stack is pointers, at the moment, I believe Uh-oh... not the answer I wanted to hear, but I was half-expecting this. So doesn't that mean that, at the moment, D will leak memory? > If it's not on the garbage collected heap, it won't scan it unless you tell it to. B

Re: D Language info collected and combined into one CHM file.

2011-01-07 Thread Andrej Mitrovic
Vladimir already made an automatic script that does this, see: http://thecybershadow.net/d/docs/

Re: Variants for interfaces

2011-01-07 Thread Jesse Phillips
Mandeep Singh Brar Wrote: > Hi, > > Is it possible to point a variable to an interface. The below code does not > compile. > > module testD; > import std.stream; > import std.stdio; > import std.variant; > > interface A { > void func1(); > } > class AC: A { > void func1() { >

Re: D Language info collected and combined into one CHM file.

2011-01-07 Thread Jesse Phillips
david wang Wrote: > Sorry, > > surrely that I've posted the attachment (CHM file), but I can not > see it. > > Does anyone can kindly help me to point out that how to transfer > chm file to this BBS? > > waiting for kindly reply. > > > David. http://docs.google.com or maybe http://prowiki.

Re: Threads, shread and TLS

2011-01-07 Thread Adam Conner-Sax
Thanks! It's not really about correctness as much as trying to understand how these different storage classes work. I understand that there is only one foo object. I wanted to see which parts are thread-local and which are shared and how the constructors work. I'm working (way over my head) on a

Re: Threads, shread and TLS

2011-01-07 Thread Steven Schveighoffer
On Fri, 07 Jan 2011 09:55:33 -0500, Adam Conner-Sax wrote: == Quote from Adam Conner-Sax (adam_conner_...@yahoo.com)'s article So, I thought I sort of understood "shared" and now I think I don't. If I have a class: class foo { int x; static int y; shared static int z; } So x is one ins

Re: Threads, shread and TLS

2011-01-07 Thread Adam Conner-Sax
== Quote from Adam Conner-Sax (adam_conner_...@yahoo.com)'s article > So, I thought I sort of understood "shared" and now I think I don't. > If I have a class: > class foo { > int x; > static int y; > shared static int z; > } > So x is one instance per class and is thread-local? > y is one in

Variants for interfaces

2011-01-07 Thread Mandeep Singh Brar
Hi, Is it possible to point a variable to an interface. The below code does not compile. module testD; import std.stream; import std.stdio; import std.variant; interface A { void func1(); } class AC: A { void func1() { writeln("func1"); } } int main() {

Re: Threads, shread and TLS

2011-01-07 Thread Steven Schveighoffer
On Fri, 07 Jan 2011 09:24:18 -0500, Adam Conner-Sax wrote: So, I thought I sort of understood "shared" and now I think I don't. If I have a class: class foo { int x; static int y; shared static int z; } So x is one instance per class and is thread-local? y is one instance per thread

Re: How does dsource create the multiple projects?

2011-01-07 Thread Steven Schveighoffer
On Thu, 06 Jan 2011 06:25:16 -0500, Sclytrack wrote: How does dsource handle the multiple projects? Is that each projects its own trac environment. Does it use sqlite? I know not a D related question. Each project is its own trac environment. What DB is used, I'm not sure. -Steve

Re: D2 postgresql interface - Phobos2?

2011-01-07 Thread Piotr Szturmaj
How cool. Very glad you're going native D. I've used Npgsql a lot and also the more standard data.sqlclient interface from c# so I'm happy you're modeling after that API. In your "general" API, will you support the more advanced features like creating functions, refcursors, preplanning queries, et

Threads, shread and TLS

2011-01-07 Thread Adam Conner-Sax
So, I thought I sort of understood "shared" and now I think I don't. If I have a class: class foo { int x; static int y; shared static int z; } So x is one instance per class and is thread-local? y is one instance per thread? z is one instance per application, i.e., global? If that's tru

Printing wide characters in console

2011-01-07 Thread Jun
I think I found a solution for it. This code changes encoding of string to ansi which is default string encoding in windows console. import std.c.windows.windows; string ansi(string str) { wchar[] src = toUTF16(str).dup; char[] dest; dest.length = str.length; WideC

Re: D2 postgresql interface - Phobos2?

2011-01-07 Thread %fil
Hi Piotr, How cool. Very glad you're going native D. I've used Npgsql a lot and also the more standard data.sqlclient interface from c# so I'm happy you're modeling after that API. In your "general" API, will you support the more advanced features like creating functions, refcursors, preplanning q