|
HDK
|
Include dependency graph for estimateSize.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Functions | |
| template<typename T > | |
| PXR_NAMESPACE_OPEN_SCOPE size_t | VdfEstimateSize (const T &) |
| template<typename T , uint32_t N> | |
| size_t | VdfEstimateSize (const TfSmallVector< T, N > &v) |
| template<typename T , typename A > | |
| size_t | VdfEstimateSize (const std::vector< T, A > &v) |
| template<typename T > | |
| size_t | VdfEstimateSize (const std::shared_ptr< T > &p) |
|
inline |
Estimate the memory footprint of instance t of type T.
This function estimates the memory footprint of an instance of type T. Internally this is used to total up cache sizes, and give the system an opportunity to limit the memory used for execution caches.
By default, this function invokes the sizeof() operator for type T. The returned value is not a good estimate of the true memory footprint, if instances of T allocate heap memory.
Plugin writers can overload (not specialize) VdfEstimateSize for their own types in order to provide a better estimate. Note that in order for ADL to be guaranteed to find the new overload, the pattern is to declare it as an inline friend within the namespace of the class itself. Further, not polluting the unqualified namespace with these overloads also results in more succinct compiler errors if overload resolution were to fail.
Please follow the pattern established in this example:
```{.cpp} struct MyType { uint8_t *data; size_t numData;
friend size_t VdfEstimateSize(const MyType &t) { return sizeof(MyTpe) + (sizeof(uint8_t) * t.numData); } }; ```
Definition at line 55 of file estimateSize.h.
|
inline |
Overload for TfSmallVector<T, N>
Definition at line 64 of file estimateSize.h.
|
inline |
Overload for std::vector<T>
Definition at line 79 of file estimateSize.h.
|
inline |
Overload for std::shared_ptr<T>
Definition at line 93 of file estimateSize.h.