Giter VIP home page Giter VIP logo

Comments (6)

hrydgard avatar hrydgard commented on May 26, 2024

I'm going to add a simple interface that lets you pass in callbacks that will be called on alloc/dealloc. That lets users of the library implement their own tracking, with zero overhead if you don't use it.

from physx-rs.

repi avatar repi commented on May 26, 2024

Assume PhysX does support overriding their allocator also? Could be quite nice to support overriding it and connect it to the Rust global memory allocator (or rather: A Rust memory allocator of the users choosing) through the standard trait or a custom one. This is what we use in our engine and great to have most heap allocations in the same main allocator. Assuming the interfaces and needs are similar.

from physx-rs.

hrydgard avatar hrydgard commented on May 26, 2024

Yeah, we can also replace the whole allocator. Can try that instead. Physx does send in a bit of extra metadata that we really want to track separately (as Emil mentions), but can then pass through to a Rust alloc.

from physx-rs.

repi avatar repi commented on May 26, 2024

Cool, worth a shot

from physx-rs.

Hentropy avatar Hentropy commented on May 26, 2024

I implemented a super rudimentary tracking allocator here.
If the allocation name feature works, that would enable a proper type aware allocator which would be amazing, but IIRC it's debug only, and debug doesn't work or something. I'd love to be wrong there though.
Without that, the allocator is a C-style void-pointer allocator, and wrapping Rust's lovely type aware one in that feels dirty.

from physx-rs.

hrydgard avatar hrydgard commented on May 26, 2024

The allocation name feature actually kinda mostly works in release mode, you just have to call
foundation.set_report_allocation_names(true);. PhysX does a quite good job of pooling internally so most of what you'll see are pools of various types.

In our application we implemented a tracker on top of the trampoline I added in #94 , actually very similar to yours.

from physx-rs.

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.