Skip to content

Two questions about MemoryAllocator override #703

@hzqst

Description

@hzqst
  1. Seems there is no way to override the g_pRawAllocator from Archiver dll?
Image

I am getting crash on RefCountedObject dtor now as RenderStateCacheImpl was created with DefaultRawAllocator from Archiver dll (ms crt malloc in this case) instead of mi_malloc override.

Image

A potential fix would be adding virtual SetRawAlloctor(IMemoryAllocator *) = 0; as a new interface in Archiver Factory.

  1. I was playing with StringDataBlobImpl :
char shaderName[256]{};
//snprintf...
auto ShaderName = Diligent::StringDataBlobImpl::Create(shaderName);

however I found no MemoryAllocator override for StringDataBlobImpl, I have to go with DataBlobImpl as a workaround:

char shaderName[256]{};
//snprintf...
auto ShaderName = Diligent::DataBlobImpl::Create(&DiligentRenderer()->GetDefaultAllocator(), strlen(shaderName), shaderName);\
Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions