@@ -681,16 +681,16 @@ static int64_t last_gc_total_bytes = 0;
681
681
// max_total_memory is a suggestion. We try very hard to stay
682
682
// under this limit, but we will go above it rather than halting.
683
683
#ifdef _P64
684
- typedef uint64_t memsize_t ;
685
- static const size_t default_collect_interval = 5600 * 1024 * sizeof (void * );
686
- static const size_t max_collect_interval = 1250000000UL ;
687
- static size_t total_mem ;
684
+ typedef int64_t memsize_t ;
685
+ static const int64_t default_collect_interval = 5600 * 1024 * sizeof (void * );
686
+ static const int64_t max_collect_interval = 1250000000UL ;
687
+ static int64_t total_mem ;
688
688
// We expose this to the user/ci as jl_gc_set_max_memory
689
689
static memsize_t max_total_memory = (memsize_t ) 2 * 1024 * 1024 * 1024 * 1024 * 1024 ;
690
690
#else
691
- typedef uint32_t memsize_t ;
692
- static const size_t default_collect_interval = 3200 * 1024 * sizeof (void * );
693
- static const size_t max_collect_interval = 500000000UL ;
691
+ typedef int32_t memsize_t ;
692
+ static const int32_t default_collect_interval = 3200 * 1024 * sizeof (void * );
693
+ static const int32_t max_collect_interval = 500000000UL ;
694
694
// Work really hard to stay within 2GB
695
695
// Alternative is to risk running out of address space
696
696
// on 32 bit architectures.
@@ -3948,13 +3948,17 @@ void jl_gc_init(void)
3948
3948
3949
3949
JL_DLLEXPORT void jl_gc_set_max_memory (uint64_t max_mem )
3950
3950
{
3951
- if (max_mem > 0
3952
- && max_mem < (uint64_t )1 << (sizeof (memsize_t ) * 8 - 1 )) {
3951
+ #ifdef _P64
3952
+ const int64_t max_allowed_value = INT64_MAX ;
3953
+ #else
3954
+ const int32_t max_allowed_value = INT32_MAX ;
3955
+ #endif
3956
+ if (max_mem > 0 && max_mem < max_allowed_value ) {
3953
3957
max_total_memory = max_mem ;
3954
3958
}
3955
3959
}
3956
3960
3957
- JL_DLLEXPORT uint64_t jl_gc_get_max_memory (void )
3961
+ JL_DLLEXPORT int64_t jl_gc_get_max_memory (void )
3958
3962
{
3959
3963
return max_total_memory ;
3960
3964
}
0 commit comments