Skip to content

Clash in Vulkan "CreateInstance()" Times #1843

Description

@kgs233

What happened?

When I was trying to create a Vulkan instance, I ran into a strange issue where it would crash without error from time to time.
Specifically:

Vk vk = Vk.GetApi();
...
vk.CreateInstance(createInfo, null, out Instance pInstance); //There
...

After that, the program just exits without leaving any error message (but this is only in the terminal and in vscode, in vs it will report an error "heap memory corruption")
In Debug mode the program returns 0xC0000374, which is shown in the windows log tracker as "STATUS_HEAP_CORRUPTION".

What might have happened?

I' dont knowI think the problem is with P/Invoke though, maybe the GC is reclaiming resources that shouldn't be reclaimed? But I don't know how to fix it.

Where's the weird part?

This problem doesn't always happen, sometimes it works fine in debug mode but not in release mode, sometimes it works fine in the debugger but not outside of it, and even sometimes it still occurs from time to time when you run the same version of the program in the same environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions