@@ -117,13 +117,14 @@ Example: `16GB` or `50%` (of system total)."
117
117
118
118
#[ clap(
119
119
long,
120
- default_value = "0B" ,
120
+ default_value = None ,
121
121
long_help = r"An upper limit on how much memory the gRPC server (`--serve-web`) should use.
122
122
The server buffers log messages for the benefit of late-arriving viewers.
123
123
When this limit is reached, Rerun will drop the oldest data.
124
- Example: `16GB` or `50%` (of system total)."
124
+ Example: `16GB` or `50%` (of system total).
125
+ Default is `0B`, or `25%` if any of the `--serve-*` flags are set."
125
126
) ]
126
- server_memory_limit : String ,
127
+ server_memory_limit : Option < String > ,
127
128
128
129
#[ clap(
129
130
long,
@@ -163,13 +164,17 @@ When persisted, the state will be stored at the following locations:
163
164
///
164
165
/// The server will act like a proxy, listening for incoming connections from
165
166
/// logging SDKs, and forwarding it to Rerun viewers.
167
+ ///
168
+ /// Using this sets the default `--server-memory-limit` to 25% of available system memory.
166
169
#[ clap( long) ]
167
170
serve_web : bool ,
168
171
169
172
/// This will host a gRPC server.
170
173
///
171
174
/// The server will act like a proxy, listening for incoming connections from
172
175
/// logging SDKs, and forwarding it to Rerun viewers.
176
+ ///
177
+ /// Using this sets the default `--server-memory-limit` to 25% of available system memory.
173
178
#[ clap( long) ]
174
179
serve_grpc : bool ,
175
180
@@ -720,7 +725,19 @@ fn run_impl(
720
725
#[ cfg( feature = "server" ) ]
721
726
let server_memory_limit = {
722
727
re_log:: debug!( "Parsing memory limit for gRPC server" ) ;
723
- re_memory:: MemoryLimit :: parse ( & args. server_memory_limit )
728
+ let value = match & args. server_memory_limit {
729
+ Some ( v) => v. as_str ( ) ,
730
+ None => {
731
+ // When spawning just a server, we don't want the memory limit to be 0.
732
+ if args. serve || args. serve_web || args. serve_grpc {
733
+ "25%"
734
+ } else {
735
+ "0B"
736
+ }
737
+ }
738
+ } ;
739
+ re_log:: debug!( "Server memory limit: {value}" ) ;
740
+ re_memory:: MemoryLimit :: parse ( value)
724
741
. map_err ( |err| anyhow:: format_err!( "Bad --server-memory-limit: {err}" ) ) ?
725
742
} ;
726
743
0 commit comments