www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19191] New: Memory allocation failure with -profile=gc and


          Issue ID: 19191
           Summary: Memory allocation failure with -profile=gc and dynamic
                    array of opaque handles
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: goalitium dissues.mail.kapsi.fi

Following minified code from a project using ErupteD Vulkan bindings crashes to
"core.exception.OutOfMemoryError src/core/exception.d(700): Memory allocation
failed" when compiled with -profile=gc:

struct VkInstance_handle;
alias VkInstance = VkInstance_handle*;

void main()
    VkInstance[] instances = new VkInstance[1];

This can be worked around by changing the opaque handle declaration to:
struct VkInstance_handle {};

The related issue in ErupteD GitHub:

Aug 25 2018