MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / CustomAllocator

Class CustomAllocator

tools/cli/NtcCommandLine.cpp:1795–1822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1793}
1794
1795class CustomAllocator : public ntc::IAllocator
1796{
1797public:
1798 void* Allocate(size_t size) override
1799 {
1800 void* ptr = malloc(size);
1801 // printf("Allocating %zu bytes at %p.\n", size, ptr);
1802 m_bytesAllocated += size;
1803 return ptr;
1804 }
1805
1806 void Deallocate(void* ptr, size_t size) override
1807 {
1808 if (!ptr)
1809 return;
1810 // printf("Deallocating %zu bytes at %p.\n", size, ptr);
1811 m_bytesAllocated -= size;
1812 free(ptr);
1813 }
1814
1815 int64_t GetBytesAllocated() const
1816 {
1817 return m_bytesAllocated;
1818 }
1819
1820private:
1821 int64_t m_bytesAllocated = 0;
1822};
1823
1824
1825int main(int argc, const char** argv)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected