Skip to content
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

memory check of lrun #36

Open
drwolf1999 opened this issue Aug 2, 2020 · 2 comments
Open

memory check of lrun #36

drwolf1999 opened this issue Aug 2, 2020 · 2 comments

Comments

@drwolf1999
Copy link

drwolf1999 commented Aug 2, 2020

In lrun, is memory measurement based on stack or heap? It feels like lrun doesn't check the stack memory.
The reason for this was that there was no difference in the amount of memory used, even though the arrangement was large for the CPP-code.

before

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
priority_queue Q;
int main() {
int a, b;
cin >> a >> b;
cout << a + b;
for (int i = 1; i <= 10000000; i++) {
Q.push(i);
}
return 0;
}

after

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
LL D1[10000][10000];
priority_queue Q;
int main() {
int a, b;
cin >> a >> b;
cout << a + b;
for (int i = 1; i <= 10000000; i++) {
Q.push(i);
}
return 0;
}

The memory measurements for the above two codes were the same.

@quark-zju
Copy link
Owner

It uses cgroup's memory counter. I think it might be counting page faults. Writing to heap or stack both cause page faults and are counted. Do you expect stack and heap to be counted differently?

@drwolf1999
Copy link
Author

drwolf1999 commented Aug 7, 2020

It uses cgroup's memory counter. I think it might be counting page faults. Writing to heap or stack both cause page faults and are counted. Do you expect stack and heap to be counted differently?

Oh, I see..... This program seems to check the stack memory of the array D1 normally. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants