OpenUSD icon indicating copy to clipboard operation
OpenUSD copied to clipboard

rpmalloc and USD

Open plekakis opened this issue 1 year ago • 1 comments

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::vectorstd::string UsdHelper::GetExternalReferencesOrPayloads(pxr::UsdPrim const& i_prim) { std::vectorstd::string 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

plekakis avatar Mar 28 '24 18:03 plekakis

Filed as internal issue #USD-9500

jesschimein avatar Mar 29 '24 17:03 jesschimein