简体   繁体   English

是否可以为perforce(p4api)定义自定义分配器?

[英]Is it possible to define custom allocators for perforce (p4api)?

In the Perforce c++ api is it possible to provide a custom allocator so that a function like StrBuf::Alloc() uses the functions I provide rather than regular old new/delete or malloc/free? Perforce c ++ api中是否可以提供自定义分配器,以便像StrBuf :: Alloc()这样的函数使用我提供的函数,而不是常规的旧new / delete或malloc / free?

This is primarily to maintain control over how memory is used by my program, but also to provide metrics and whatnot so that I can see how memory is used. 这主要是为了保持对我的程序如何使用内存的控制,而且还提供指标和诸如此类的东西,以便我可以了解如何使用内存。 If it doesn't go through my system then it's untracked and unaccounted for. 如果它没有通过我的系统,那么它将无法跟踪和无法解释。

It's possible to create your own StrPtr subclass for your own use, but you can't change memory allocation inside the P4 client library. 可以创建自己的StrPtr子类供自己使用,但不能在P4客户端库中更改内存分配。

Enabling debugging inside the heap itself might provide you with the type of analysis you're looking for: https://www.itprotoday.com/microsoft-visual-studio/debug-heap-issues-using-full-page-heap 在堆本身内部启用调试可能会为您提供所需的分析类型: https : //www.itprotoday.com/microsoft-visual-studio/debug-heap-issues-using-full-page-heap

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM