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

numa_preferred API has memory leak #138

Closed
luochenglcs opened this issue Sep 20, 2022 · 1 comment
Closed

numa_preferred API has memory leak #138

luochenglcs opened this issue Sep 20, 2022 · 1 comment

Comments

@luochenglcs
Copy link
Collaborator

#include <numa.h>
  
void main(void)
{
   while (1) {
        numa_preferred();
   }
}

numa_preferred API has memory leak.

build:

gcc -g test_preferred.c -lnuma -o test_preferred

run:

[root@localhost home]# ./test_preferred

[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.6Gi        10Gi        19Mi       906Mi        10Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.7Gi        10Gi        19Mi       906Mi        10Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.8Gi         9Gi        19Mi       906Mi        10Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.8Gi       9.9Gi        19Mi       906Mi        10Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.9Gi       9.8Gi        19Mi       906Mi        10Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       5.0Gi       9.8Gi        19Mi       906Mi        10Gi
Swap:            0B          0B          0B
@luochenglcs
Copy link
Collaborator Author

we fix it by freeing bmp.

[root@localhost home]# ./test_preferred

[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.3Gi        11Gi        19Mi       121Mi        11Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.3Gi        11Gi        19Mi       121Mi        11Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.3Gi        11Gi        19Mi       121Mi        11Gi
Swap:            0B          0B          0B
[root@localhost numactl]# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       4.3Gi        11Gi        19Mi       121Mi        11Gi
Swap:            0B          0B          0B

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

1 participant