PixarAnimationStudios / OpenUSD

Universal Scene Description
http://www.openusd.org
Other
5.45k stars 1.13k forks source link

rpmalloc and USD #3023

Open plekakis opened 1 month ago

plekakis commented 1 month ago

Description of Issue

I am using rpmalloc in my project as a global new/delete override internal implementation for them and although most of the USD functionality is fine across DLL boundaries, I notice that the following class causes problem: pxr::UsdPrimCompositionQuery query(i_prim, filter);

It seems to allocate in the constructor using std::make_shared and when the instance of the composition query goes out of scope it tries to de-allocate something inside the query (I presume it's the "_expandedPrimIndex"?) and the de-allocation goes through my rpmalloc path. So it seems that the allocation and de-allocation paths don't match.

I don't know if this is just local to me, is it possible to reproduce it at all?

Steps to Reproduce

  1. Use the DLL version of USD and in your project which uses rpmalloc (or equivalent probably) and allocate a new UsdPrimCompositionQuery. My function looks like this:

std::vector UsdHelper::GetExternalReferencesOrPayloads(pxr::UsdPrim const& i_prim) { std::vector filenames; // Setup a composition query to search for references or payloads. pxr::UsdPrimCompositionQuery::Filter filter; filter.arcTypeFilter = pxr::UsdPrimCompositionQuery::ArcTypeFilter::ReferenceOrPayload; filter.dependencyTypeFilter = pxr::UsdPrimCompositionQuery::DependencyTypeFilter::Direct;

pxr::UsdPrimCompositionQuery query(i_prim, filter);
auto arcs = query.GetCompositionArcs();
... do something with the arcs ...
return filenames;

}

System Information (OS, Hardware)

Windows 11

Package Versions

Latest

Build Flags

build_usd.py --no-python --no-imaging --no-tools --no-docs --no-tutorials --no-examples --no-tests --no-python-docs --build-variant=release --build-monolithic --build-args USD

jesschimein commented 1 month ago

Filed as internal issue #USD-9500