-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cling] Memory hogging when checking if type is an enum #10454
Comments
Related (or maybe the exact same issue): #9029 |
I don't know if it is an option at that place in the code but calling a combination of |
Dear experts, @etejedor, I think I am facing a similar memory usage problem in PyROOT (ROOT 6.24/06). Do you know if this issue has been fixed? If yes, in which release? Thanks a lot! |
Dear Alberto, I'm afraid this is not yet fixed, but @Axel-Naumann can confirm. |
@etejedor #10454 (comment) suggests a change in PyROOT. Can you confirm whether that helps? |
So iiuc the suggestion is to replace this line by something like |
Something along the lines of if (TClass::GetClass(tn_short.c_str()) return false;
return gInterpreter->ClassInfo_IsEnum(tn_short.c_str()); maybe? |
Thanks @Axel-Naumann , so |
Right - |
As reported in issue root-project#10454, calling ClassInfo_IsEnum() repeatedly increases the memory consumption of the program. This does not happen with TEnum::GetEnum, which can be used instead.
|
#11412 revealed a test failure caused by the switch to enum EFruit {kApple=78, kBanana=29, kCitrus=34};
void repro()
{
auto type = "std::vector<EFruit>::value_type";
cout << gInterpreter->ClassInfo_IsEnum(type) << endl;
cout << TEnum::GetEnum(type) << endl;
} which prints
The different answer between the two calls is what makes the test fail. |
Another instance of the issue can be seen at: https://root-forum.cern.ch/t/possible-memory-leakage/54519 |
in #10454 (comment), the typedef is not being resolved, i.e.
prints
|
Initially reported here:
https://root-forum.cern.ch/t/pyroot-and-std-vector-dramatic-ram-usage/49711
when a user was getting a
vector<int>
branch from a tree in a loop in PyROOT.After a bit of digging, it seems the culprit is a call that is made from cppyy to
TInterpreter::ClassInfo_IsEnum
. The following is a C++ reproducer (tested with current master):When running the macro above, it can be seen how the memory usage increases after each iteration.
The text was updated successfully, but these errors were encountered: