Thread overview
GC-free techniques for a wiki page - Was: Smart pointers instead of GC?
Feb 01, 2014
Andrej Mitrovic
Feb 02, 2014
Mike
Feb 02, 2014
Peter Alexander
Feb 03, 2014
Gopan
Feb 03, 2014
Dicebot
Feb 03, 2014
Marco Leise
February 01, 2014
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. :)
February 02, 2014
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".
February 02, 2014
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.
February 03, 2014
Is it possible to switch off GC during compilation so that I will get
compilation error on every statement that invites GC in?
February 03, 2014
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.
February 03, 2014
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