Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
October 26, 2016 Avoiding GC | ||||
---|---|---|---|---|
| ||||
Is there a page somewhere on how to program D without using the GC? How do I allocate / free structs / classes on the heap manually? New would be GCed memeory wouldnt it? Delete is being depreciated? thanks. |
October 26, 2016 Re: Avoiding GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to hardreset | On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote: > Is there a page somewhere on how to program D without using the GC? How do I allocate / free structs / classes on the heap manually? New would be GCed memeory wouldnt it? Delete is being depreciated? > > thanks. Probably you want to read: https://dlang.org/phobos/std_experimental_allocator.html Anyway GC works really good for common software development. |
October 26, 2016 Re: Avoiding GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to hardreset | On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote: > Is there a page somewhere on how to program D without using the GC? How do I allocate / free structs / classes on the heap manually? New would be GCed memeory wouldnt it? Delete is being depreciated? > > thanks. There is the following: https://wiki.dlang.org/Memory_Management |
October 27, 2016 Re: Avoiding GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to hardreset | On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote: > Is there a page somewhere on how to program D without using the GC? The information is scattered. > How do I allocate / free structs / classes on the heap manually? Classes => https://github.com/AuburnSounds/dplug/blob/master/core/dplug/core/nogc.d#L122 > New would be GCed memeory wouldnt it? Yes. > Delete is being depreciated? I don't think you ever want delete when there is .destroy |
October 28, 2016 Re: Avoiding GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Guillaume Piolat | On Thursday, 27 October 2016 at 07:52:09 UTC, Guillaume Piolat wrote:
> On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote:
>> Is there a page somewhere on how to program D without using the GC?
>
> The information is scattered.
>
>
>> How do I allocate / free structs / classes on the heap manually?
>
> Classes => https://github.com/AuburnSounds/dplug/blob/master/core/dplug/core/nogc.d#L122
Thanks.
I notice you avoid GC altogether in dplug. Whats the reason for total avoidance as apposed to just avoiding it in the real time code?
|
October 28, 2016 Re: Avoiding GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to hardreset | On Friday, 28 October 2016 at 11:50:20 UTC, hardreset wrote:
> On Thursday, 27 October 2016 at 07:52:09 UTC, Guillaume Piolat wrote:
>> On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote:
>>> Is there a page somewhere on how to program D without using the GC?
>>
>> The information is scattered.
>>
>>
>>> How do I allocate / free structs / classes on the heap manually?
>>
>> Classes => https://github.com/AuburnSounds/dplug/blob/master/core/dplug/core/nogc.d#L122
>
> Thanks.
>
> I notice you avoid GC altogether in dplug. Whats the reason for total avoidance as apposed to just avoiding it in the real time code?
Not a lot of reason.
It's very recent work, I'm still struggling making threadpool works.
- Reason #1 was that it gives a way to unload shared libraries on OSX. This bug has been fixed in LDC but would require to make druntime and phobos a shared library to ship. That makes releases 3x larger so I went with disabling the runtime instead (one month of work and still going...).
- Reason #2 is that GC does use more memory. Next release of our products use 2x fewer memory.
All in all it's _painful_ not to use the D runtime, suddenly you can't use third-party code, and there is no performance enhancement to expect apart from reduced memory usage.
Don't avoid the runtime on principles alone.
|
Copyright © 1999-2021 by the D Language Foundation