File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,28 @@ JL_DLLEXPORT uint64_t jl_get_pg_size(void)
2828
2929static int block_pg_cnt = DEFAULT_BLOCK_PG_ALLOC ;
3030
31+ // Julia allocates large blocks (64M) with mmap. These are never
32+ // unmapped but the underlying physical memory may be released
33+ // with calls to madvise(MADV_DONTNEED).
34+ static uint64_t poolmem_blocks_allocated_total = 0 ;
35+
36+ JL_DLLEXPORT uint64_t jl_poolmem_blocks_allocated_total (void )
37+ {
38+ return poolmem_blocks_allocated_total ;
39+ }
40+
41+ JL_DLLEXPORT uint64_t jl_poolmem_bytes_allocated (void )
42+ {
43+ return jl_atomic_load_relaxed (& gc_heap_stats .bytes_resident );
44+ }
45+
46+ JL_DLLEXPORT uint64_t jl_current_pg_count (void )
47+ {
48+ assert (jl_page_size == GC_PAGE_SZ && "RAI fork of Julia should be running on platforms for which jl_page_size == GC_PAGE_SZ" );
49+ size_t nb = jl_atomic_load_relaxed (& gc_heap_stats .bytes_resident );
50+ return nb / GC_PAGE_SZ ; // exact division
51+ }
52+
3153void jl_gc_init_page (void )
3254{
3355 if (GC_PAGE_SZ * block_pg_cnt < jl_page_size )
@@ -62,6 +84,7 @@ char *jl_gc_try_alloc_pages_(int pg_cnt) JL_NOTSAFEPOINT
6284 mem = (char * )gc_page_data (mem + GC_PAGE_SZ - 1 );
6385 jl_atomic_fetch_add_relaxed (& gc_heap_stats .bytes_mapped , pages_sz );
6486 jl_atomic_fetch_add_relaxed (& gc_heap_stats .bytes_resident , pages_sz );
87+ poolmem_blocks_allocated_total ++ ; // RAI-specific
6588 return mem ;
6689}
6790
You can’t perform that action at this time.
0 commit comments