File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,11 @@ func DefineCommonFlags(cmd *cobra.Command) {
125125}
126126
127127func calculateMemoryLimit (memleft uint64 ) uint64 {
128+ // Special case: if no memory left, return 0
129+ if memleft == 0 {
130+ return 0
131+ }
132+
128133 // memreserved = f(memleft) = 512MB * memleft / (memleft + 4GB)
129134 // * f(0) = 0
130135 // * f(4GB) = 256MB
@@ -134,10 +139,11 @@ func calculateMemoryLimit(memleft uint64) uint64 {
134139 // Prevent uint64 underflow when memreserved >= memleft
135140 // This can happen when available memory is very low (< 256MB)
136141 if memreserved >= memleft {
137- log .Warn ("insufficient memory left for BR, using minimum limit " ,
142+ log .Warn ("insufficient memory left for BR, capping to available " ,
138143 zap .Uint64 ("memleft" , memleft ),
139144 zap .Uint64 ("memreserved" , memreserved ))
140- return quarterGiB // Return minimum limit (256 MB)
145+ // Return available memory instead of forcing a minimum
146+ return memleft
141147 }
142148
143149 // 0 memused memtotal-memreserved memtotal
You can’t perform that action at this time.
0 commit comments