- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm seeing unexpectedly growing memory use in an application and have tracked it back to use of a static std::unique_ptr. This is reproduced on the below minimal reproducing example
#include <memory>
int main(int argc, char** argv) {
while(1==1) {
static std::unique_ptr<int> temp;
temp.reset();
}
}
I'm using IntelOneAPI-2021.3.0 and the above example is compiled with default icc arguments. In the example memory use grows quickly and without bound. It appears each and every time the program runs past the static line roughly 40 bytes of memory are consumed. I do not see memory growth with this example, or the original larger application, when using other compilers such as g++.
In the short term I will just avoid use of this pattern. But wanted to report in case there is some underlying bug here.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please let us know whether you have any other reproducer code facing issues with icx compiler 2023.0 with memory growth?
If not, we suggest you use icx compiler instead of icc compiler because
Intel® C++ Compiler Classic (icc) is deprecated and will be removed in a oneAPI release in the second half of 2023. Intel recommends that customers transition now to using the LLVM-based Intel® oneAPI DPC++/C++ Compiler (icx) for continued Windows* and Linux* support, new language support, new language features, and optimizations.
Thanks & Regards
Shivani
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For a bit more information I also see this same behavior using the more recent IntelOneAPI-2023.0.0.
I'm running on a Linux Red Hat 7 system with CPU info "Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for posting in the Intel forums.
Could you please let us know if you are facing a similar issue with Intel(R) oneAPI DPC++/C++ Compiler 2023.0.0 (icx compiler)?
Could you also please let us know how you are checking unexpectedly growing memory use in an application?
Thanks & Regards
Shivani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Shivani,
Thanks for the reply.
For the small example I do not see the memory growth when using icx 2023.0.0. I also don't see any memory growth when using the 2021.3.0 version of icx. So it looks like whatever is occurring here might be specific to the classic compiler.
For checking the memory use on the small example I was just monitoring with the unix 'top' command. For me the small example reaches ~10GB memory use after ~15 seconds and the system kills it at about the ~60 second mark when the memory use reaches ~60GB. In the original application the same trends were observed, though it took several hours for the memory to grow to the point of crashing the program, mostly just due to hitting the problematic 'static unique_ptr' line less frequently.
-Nate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please let us know whether you have any other reproducer code facing issues with icx compiler 2023.0 with memory growth?
If not, we suggest you use icx compiler instead of icc compiler because
Intel® C++ Compiler Classic (icc) is deprecated and will be removed in a oneAPI release in the second half of 2023. Intel recommends that customers transition now to using the LLVM-based Intel® oneAPI DPC++/C++ Compiler (icx) for continued Windows* and Linux* support, new language support, new language features, and optimizations.
Thanks & Regards
Shivani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No I don't have any evidence of an issue in icx 2023 regarding this. So that upgrade path makes sense to me. Thanks!
-Nate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thanks for accepting our solution. If you need any additional information please post a new question as this thread will no longer be monitored by Intel.
Thanks & Regards
Shivani

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page