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 Leak Detection: Casbin #243

Closed
fishsclue opened this issue Feb 20, 2024 · 1 comment · Fixed by #246
Closed

Memory Leak Detection: Casbin #243

fishsclue opened this issue Feb 20, 2024 · 1 comment · Fixed by #246
Assignees
Labels
bug Something isn't working

Comments

@fishsclue
Copy link

fishsclue commented Feb 20, 2024

Description

Calling the enforce method in a loop causes the memory usage to go up all the time, how can I fix this?

Your System Info

#include <iostream>
#include <casbin/casbin.h>

using namespace std;
using namespace casbin;

int main() {
    
    Enforcer enforcer("path/to/model.conf", "path/to/policy.csv");

    
    string sub = "alice";  
    string obj = "data1";  
    string act = "read";   

    
    for (int i = 0; i < 10000; ++i) {
        if (enforcer.Enforce(sub, obj, act)) {
            cout << "allow" << endl;
        } else {
            cout << "deny" << endl;
        }
    }

    return 0;
}

Screenshots/Testimonials

@casbin-bot
Copy link
Member

@casbin-bot casbin-bot added the question Further information is requested label Feb 20, 2024
@hsluoyz hsluoyz mentioned this issue Feb 20, 2024
@hsluoyz hsluoyz added bug Something isn't working and removed question Further information is requested labels Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

3 participants