Giter Club home page Giter Club logo

Comments (5)

kuhar avatar kuhar commented on August 15, 2024

Since there isn't any aligned realloc primitive in POSIX, I think a good workaround would be to prepend a header to each allocation and remember the allocation size there.

from xgl.

JonCampbell407 avatar JonCampbell407 commented on August 15, 2024

That looks fairly broken. I'm not aware of a case where we use realloc but I'm guessing you've hit one.

from xgl.

kuhar avatar kuhar commented on August 15, 2024

@JonCampbell407 Are you fine with moving forward with a fix along these lines?

I think a good workaround would be to prepend a header to each allocation and remember the allocation size there.

from xgl.

JonCampbell407 avatar JonCampbell407 commented on August 15, 2024

Doing that would add a small amount of overhead to every allocation. Since realloc is never used in the driver I'd rather not do that. I think we should just change DefaultReallocFunc() to assert with VK_NEVER_CALLED(). What are you doing to hit this? I can't think of a case where we would want to use realloc in the driver.

from xgl.

kuhar avatar kuhar commented on August 15, 2024

Like you suggest, bailing out sound more lightweight that doing extra work on every allocation and free. I don't know if there would be any measurable slowdown caused by adding such header to every allocation.
I'll prepare a PR to return a nullptr and assert in reallocation to make sure things don't misbehave in the future..

I hit this when working on cache creator and testing corner cases related to possible error codes after my refactoring changes. The ICD doesn't use realloc but we have a vulkan layer test that does reallocation. I wanted to move default vulkan allocation function implementation to either PAL or the XGL cache support library and use them in the cache creator tool.

from xgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.