Thread overview
Tell GC to use shared memory
Oct 08, 2015
tcak
Oct 08, 2015
ketmar
Oct 08, 2015
tcak
Oct 08, 2015
Kagamin
Oct 12, 2015
thedeemon
October 08, 2015
Is it possible to modify GC (without rebuilding the compiler), so it uses a given shared memory area instead of heap for allocations?
October 08, 2015
On Thursday, 8 October 2015 at 04:38:43 UTC, tcak wrote:
> Is it possible to modify GC (without rebuilding the compiler), so it uses a given shared memory area instead of heap for allocations?

sure. you don't need to rebuild the compiler, only druntime.
October 08, 2015
On Thursday, 8 October 2015 at 05:46:31 UTC, ketmar wrote:
> On Thursday, 8 October 2015 at 04:38:43 UTC, tcak wrote:
>> Is it possible to modify GC (without rebuilding the compiler), so it uses a given shared memory area instead of heap for allocations?
>
> sure. you don't need to rebuild the compiler, only druntime.

Any better solution? Like overriding GC class, etc.
October 08, 2015
GC is chosen at link time simply to satisfy unresolved symbols. You only need to compile your modified GC and link with it, it will be chosen instead of GC from druntime, no need to recompile anything else.
October 12, 2015
On Thursday, 8 October 2015 at 09:25:36 UTC, tcak wrote:
> On Thursday, 8 October 2015 at 05:46:31 UTC, ketmar wrote:
>> On Thursday, 8 October 2015 at 04:38:43 UTC, tcak wrote:
>>> Is it possible to modify GC (without rebuilding the compiler), so it uses a given shared memory area instead of heap for allocations?
>>
>> sure. you don't need to rebuild the compiler, only druntime.
>
> Any better solution? Like overriding GC class, etc.

You can install your own GC proxy, see module gc.proxy in druntime, the struct Proxy and functions gc_getProxy, gc_setProxy. No need to recompile druntime.

Here's an example where I install my own GC proxy to do all allocations in my arena:
https://bitbucket.org/infognition/dstuff/src/97cef6d4a0438f9a9f4ff0d18f819262b8a74888/gcarena.d?at=default&fileviewer=file-view-default