druntime icon indicating copy to clipboard operation
druntime copied to clipboard

Avoid GC allocation when building the search path

Open ryuukk opened this issue 3 years ago • 4 comments

ryuukk avatar Mar 10 '21 14:03 ryuukk

Thanks for your pull request and interest in making D better, @ryuukk! We are looking forward to reviewing it, and you should be hearing from a maintainer soon. Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + druntime#3391"

dlang-bot avatar Mar 10 '21 14:03 dlang-bot

Where was the GC allocation happening before?

string stuff


I bit of context, i'm trying to enforce a nogc globally using:

hack
    extern (C) __gshared string[] rt_options = ["gcopt=initReserve:0"];

    extern (C) void* gc_malloc(size_t sz, uint ba = 0, const TypeInfo = null)
    {
        import core.stdc.stdio: printf;
        import core.stdc.stdlib: abort;
        printf("no gc_malloc\n");
        abort();
        return null;
    }

    extern (C) void* gc_calloc(size_t sz, uint ba = 0, const TypeInfo = null)
    {
        import core.stdc.stdio: printf;
        import core.stdc.stdlib: abort;
        printf("no gc_calloc\n");
        abort();
        return null;
    }

    extern (C) auto gc_qalloc(size_t sz, uint ba = 0, const TypeInfo = null)
    {
        import core.stdc.stdio: printf;
        import core.stdc.stdlib: abort;
        printf("no gc_qalloc\n");
        abort();
        return 0;
    }

Works fine when i don't init the runtime extern(C) int main()

I now want to init the runtime, so i'm trying to remove all the GC allocations, so i can keep use this hack

This PR is small because it's my trying to learn the workflow to contribute

ryuukk avatar Mar 16 '21 17:03 ryuukk

@ryuukk Currently, this is failing the autotester.

RazvanN7 avatar Aug 31 '21 08:08 RazvanN7

ping @ryuukk

RazvanN7 avatar Apr 28 '22 13:04 RazvanN7