www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - GC-free techniques for a wiki page - Was: Smart pointers instead of

reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/31/14, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Bumping old thread:

 There is an ever-increasing amount of newcomers in #d on IRC who
 end up asking how to avoid the GC or at least to be able to
 determine where implicit allocations happen. I think we should
 work on creating a wiki page and gather as much advice as
 possible on dealing with the GC, implicit allocations, real-time
 constraints, etc.

It looks like this post was missed, and instead people started replying to messages from over a year ago. :)
Feb 01 2014
parent reply "Mike" <none none.com> writes:
On Saturday, 1 February 2014 at 20:26:51 UTC, Andrej Mitrovic 
wrote:
 On 1/31/14, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Bumping old thread:

 There is an ever-increasing amount of newcomers in #d on IRC 
 who
 end up asking how to avoid the GC or at least to be able to
 determine where implicit allocations happen. I think we should
 work on creating a wiki page and gather as much advice as
 possible on dealing with the GC, implicit allocations, 
 real-time
 constraints, etc.

It looks like this post was missed, and instead people started replying to messages from over a year ago. :)

I found this page quite useful (http://dlang.org/memory.html), but I acknowledge it's probably not enough. I've only been here a short time, but I'm beginning to see that things with "we should" likely won't every happen until they are replaced with "I should".
Feb 01 2014
parent reply "Peter Alexander" <peter.alexander.au gmail.com> writes:
On Sunday, 2 February 2014 at 05:30:12 UTC, Mike wrote:
 On Saturday, 1 February 2014 at 20:26:51 UTC, Andrej Mitrovic 
 wrote:
 On 1/31/14, Andrej Mitrovic <andrej.mitrovich gmail.com> wrote:
 Bumping old thread:

 There is an ever-increasing amount of newcomers in #d on IRC 
 who
 end up asking how to avoid the GC or at least to be able to
 determine where implicit allocations happen. I think we should
 work on creating a wiki page and gather as much advice as
 possible on dealing with the GC, implicit allocations, 
 real-time
 constraints, etc.

It looks like this post was missed, and instead people started replying to messages from over a year ago. :)

I found this page quite useful (http://dlang.org/memory.html), but I acknowledge it's probably not enough. I've only been here a short time, but I'm beginning to see that things with "we should" likely won't every happen until they are replaced with "I should".

I wrote this a while back: http://poita.org/2012/12/15/using-d-without-the-gc.html It doesn't cover everything though, and I think the static array initialisation allocation is now out-of-date.
Feb 02 2014
parent reply "Gopan" <gopakumar.gg gmail.com> writes:
Is it possible to switch off GC during compilation so that I will 
get
compilation error on every statement that invites GC in?
Feb 03 2014
next sibling parent "Dicebot" <public dicebot.lv> writes:
On Monday, 3 February 2014 at 12:22:48 UTC, Gopan wrote:
 Is it possible to switch off GC during compilation so that I 
 will get
 compilation error on every statement that invites GC in?

No, right now only run-time asserts are possible. You may want to wait for https://github.com/D-Programming-Language/dmd/pull/1886 to be merged.
Feb 03 2014
prev sibling parent Marco Leise <Marco.Leise gmx.de> writes:
Am Mon, 03 Feb 2014 12:22:47 +0000
schrieb "Gopan" <gopakumar.gg gmail.com>:

 Is it possible to switch off GC during compilation so that I will 
 get
 compilation error on every statement that invites GC in?

I would think that parts of druntime/Phobos make use of the GC at program startup already. And in general any module not on the compiler command-line when using that switch and with only a .di file cannot be statically checked. Even lazy initialization using the GC would not work: private Foo foo; property Foo someThreadLocalFoo() { if (foo is null) foo = new Foo; // <- error return foo; } If you compile that module alone or as part of a library, the compiler has to assume that some other module will eventually make use of this function. -- Marco
Feb 03 2014