$ sudo /usr/share/bcc/tools/memleak # (...) # (much spam while I launched Galactic Civilizations III and paused the process) # (...) [23:06:22] Top 10 stacks with outstanding allocations: 9105408 bytes in 2223 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] alloc_pages_vma+0x7d [kernel] wp_page_copy+0x573 [kernel] do_wp_page+0x95 [kernel] __handle_mm_fault+0xc29 [kernel] handle_mm_fault+0xce [kernel] __do_page_fault+0x244 [kernel] do_page_fault+0x33 [kernel] page_fault+0x1e [kernel] 11509760 bytes in 2810 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] alloc_pages_vma+0x7d [kernel] wp_page_copy+0xbf [kernel] do_wp_page+0x95 [kernel] __handle_mm_fault+0xc29 [kernel] handle_mm_fault+0xce [kernel] __do_page_fault+0x244 [kernel] do_page_fault+0x33 [kernel] page_fault+0x1e [kernel] 14327808 bytes in 3498 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] __do_page_cache_readahead+0xa7 [kernel] filemap_fault+0x388 [kernel] ext4_filemap_fault+0x2d [kernel] __do_fault+0x38 [kernel] __handle_mm_fault+0xde9 [kernel] handle_mm_fault+0xce [kernel] __do_page_fault+0x244 [kernel] do_page_fault+0x33 [kernel] page_fault+0x1e [kernel] 18788352 bytes in 4587 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] alloc_pages_vma+0x7d [kernel] __handle_mm_fault+0x69f [kernel] handle_mm_fault+0xce [kernel] __do_page_fault+0x244 [kernel] do_page_fault+0x33 [kernel] page_fault+0x1e [kernel] 51302400 bytes in 12525 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] alloc_pages_vma+0x7d [kernel] __handle_mm_fault+0xe61 [kernel] handle_mm_fault+0xce [kernel] __do_page_fault+0x244 [kernel] do_page_fault+0x33 [kernel] page_fault+0x1e [kernel] copy_user_generic_string+0x2c [kernel] copyout+0x28 [kernel] copy_page_to_iter+0xb0 [kernel] generic_file_read_iter+0x330 [kernel] new_sync_read+0x15e [kernel] vfs_read+0x9d [kernel] ksys_pread64+0x65 [kernel] do_syscall_64+0x5f [kernel] entry_SYSCALL_64_after_hwframe+0x44 [kernel] 103489536 bytes in 25263 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] __do_page_cache_readahead+0xa7 [kernel] ondemand_readahead+0x198 [kernel] generic_file_read_iter+0x55f [kernel] new_sync_read+0x15e [kernel] vfs_read+0x9d [kernel] ksys_read+0x67 [kernel] do_syscall_64+0x5f [kernel] entry_SYSCALL_64_after_hwframe+0x44 [kernel] 134217728 bytes in 64 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] ttm_pool_populate+0x29f [kernel] ttm_populate_and_map_pages+0x24 [kernel] ttm_tt_populate.part.0+0x1e [kernel] ttm_tt_bind+0x48 [kernel] ttm_bo_handle_move_mem+0x25f [kernel] ttm_bo_validate+0x124 [kernel] ttm_bo_init_reserved+0x334 [kernel] amdgpu_bo_do_create+0x19f [kernel] amdgpu_bo_create+0x43 [kernel] amdgpu_gem_object_create+0x97 [kernel] amdgpu_gem_create_ioctl+0x99 [kernel] drm_ioctl_kernel+0xb8 [kernel] drm_ioctl+0x23d [kernel] amdgpu_drm_ioctl+0x49 [kernel] do_vfs_ioctl+0x43d [kernel] ksys_ioctl+0x5e [kernel] __x64_sys_ioctl+0x16 [kernel] do_syscall_64+0x5f [kernel] entry_SYSCALL_64_after_hwframe+0x44 [kernel] 189804544 bytes in 46339 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] ttm_alloc_new_pages.isra.0+0x9a [kernel] ttm_page_pool_get_pages+0x16d [kernel] ttm_pool_populate+0x1c6 [kernel] ttm_populate_and_map_pages+0x24 [kernel] ttm_tt_populate.part.0+0x1e [kernel] ttm_tt_bind+0x48 [kernel] ttm_bo_handle_move_mem+0x25f [kernel] ttm_bo_validate+0x124 [kernel] ttm_bo_init_reserved+0x334 [kernel] amdgpu_bo_do_create+0x19f [kernel] amdgpu_bo_create+0x43 [kernel] amdgpu_gem_object_create+0x97 [kernel] amdgpu_gem_create_ioctl+0x99 [kernel] drm_ioctl_kernel+0xb8 [kernel] drm_ioctl+0x23d [kernel] amdgpu_drm_ioctl+0x49 [kernel] do_vfs_ioctl+0x43d [kernel] ksys_ioctl+0x5e [kernel] __x64_sys_ioctl+0x16 [kernel] do_syscall_64+0x5f [kernel] entry_SYSCALL_64_after_hwframe+0x44 [kernel] 1159725056 bytes in 553 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] ttm_alloc_new_pages.isra.0+0x9a [kernel] ttm_page_pool_get_pages+0x16d [kernel] ttm_pool_populate+0x144 [kernel] ttm_populate_and_map_pages+0x24 [kernel] ttm_tt_populate.part.0+0x1e [kernel] ttm_tt_bind+0x48 [kernel] ttm_bo_handle_move_mem+0x25f [kernel] ttm_bo_validate+0x124 [kernel] ttm_bo_init_reserved+0x334 [kernel] amdgpu_bo_do_create+0x19f [kernel] amdgpu_bo_create+0x43 [kernel] amdgpu_gem_object_create+0x97 [kernel] amdgpu_gem_create_ioctl+0x99 [kernel] drm_ioctl_kernel+0xb8 [kernel] drm_ioctl+0x23d [kernel] amdgpu_drm_ioctl+0x49 [kernel] do_vfs_ioctl+0x43d [kernel] ksys_ioctl+0x5e [kernel] __x64_sys_ioctl+0x16 [kernel] do_syscall_64+0x5f [kernel] entry_SYSCALL_64_after_hwframe+0x44 [kernel] 2050064384 bytes in 500504 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] alloc_pages_vma+0x7d [kernel] __handle_mm_fault+0xe61 [kernel] handle_mm_fault+0xce [kernel] __do_page_fault+0x244 [kernel] do_page_fault+0x33 [kernel] page_fault+0x1e [kernel] $ killall -9 GalCiv3.exe $ sudo sh -c 'sync && free && echo 3 > /proc/sys/vm/drop_caches && sync && free' total used free shared buff/cache available Mem: 6046652 1721024 3797492 3708 528136 4077084 Swap: 0 0 0 total used free shared buff/cache available Mem: 6046652 389312 5441456 3708 215884 5418212 Swap: 0 0 0 # 1310 megabytes have been freed, some of it is legitimate caches # dropping caches after running the game twice yielded the following: $ sudo sh -c 'sync && free && echo 3 > /proc/sys/vm/drop_caches && sync && free' total used free shared buff/cache available Mem: 6046652 1737184 2556836 3632 1752632 4026484 Swap: 0 0 0 total used free shared buff/cache available Mem: 6046652 411584 5447576 3632 187492 5402588 Swap: 0 0 0 # legit + 2leak ~= 1344 /\ legit + leak ~= 1310 => leak ~= 1344-1310 = 34 [MB]?!