$ sudo /usr/share/bcc/tools/memleak # (...) # (much spam while I launched Galactic Civilizations III and paused the process) # (...) [20:58:05] Top 10 stacks with outstanding allocations: 14057472 bytes in 429 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] new_slab+0x343 [kernel] ___slab_alloc+0x44c [kernel] __slab_alloc.isra.0+0x52 [kernel] kmem_cache_alloc+0x180 [kernel] ext4_alloc_inode+0x18 [kernel] alloc_inode+0x1d [kernel] iget_locked+0xd3 [kernel] __ext4_iget+0x12d [kernel] ext4_lookup+0xd4 [kernel] __lookup_slow+0x95 [kernel] lookup_slow+0x36 [kernel] walk_component+0x1e5 [kernel] path_lookupat.isra.0+0x76 [kernel] filename_lookup+0xc2 [kernel] vfs_statx+0x8c [kernel] __se_sys_newlstat+0x4c [kernel] do_syscall_64+0x5f [kernel] entry_SYSCALL_64_after_hwframe+0x44 [kernel] 22716416 bytes in 5546 allocations from stack __alloc_pages_nodemask+0x2b3 [kernel] __alloc_pages_nodemask+0x2b3 [kernel] __do_page_cache_readahead+0xa7 [kernel] ondemand_readahead+0x198 [kernel] filemap_fault+0x266 [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] 48717824 bytes in 11894 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] 63434752 bytes in 15487 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_pread64+0x65 [kernel] do_syscall_64+0x5f [kernel] entry_SYSCALL_64_after_hwframe+0x44 [kernel] 68550656 bytes in 16736 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+0x25a [kernel] amdgpu_bo_do_create+0x19f [kernel] amdgpu_bo_create+0x43 [kernel] amdgpu_gem_object_create+0x97 [kernel] amdgpu_gem_create_ioctl+0x1ac [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] 73400320 bytes in 35 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+0x25a [kernel] amdgpu_bo_do_create+0x19f [kernel] amdgpu_bo_create+0x43 [kernel] amdgpu_gem_object_create+0x97 [kernel] amdgpu_gem_create_ioctl+0x1ac [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] 220737536 bytes in 53891 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+0x589 [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] 354521088 bytes in 86553 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] 898330624 bytes in 219319 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] 1923723264 bytes in 469659 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 687032 3396620 10560 1963000 5081680 Swap: 0 0 0 total used free shared buff/cache available Mem: 6046652 548480 5341256 10560 156916 5277496 Swap: 0 0 0 # 191 megabytes have been freed, for the most part 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 759348 3254736 10812 2032568 5009188 Swap: 0 0 0 total used free shared buff/cache available Mem: 6046652 555144 5334532 10812 156976 5270756 Swap: 0 0 0 # legit + 2leak ~= 256 /\ legit + leak ~= 191 => leak ~= 256 - 191 = 65 [MB]