diff --git a/docs/src/juliacall.md b/docs/src/juliacall.md index 2587aa10..27cd8c73 100644 --- a/docs/src/juliacall.md +++ b/docs/src/juliacall.md @@ -124,6 +124,7 @@ be configured in two ways: | `-X juliacall-threads=` | `PYTHON_JULIACALL_THREADS=` | Launch N threads. | | `-X juliacall-warn-overwrite=` | `PYTHON_JULIACALL_WARN_OVERWRITE=` | Enable or disable method overwrite warnings. | | `-X juliacall-autoload-ipython-extension=` | `PYTHON_JULIACALL_AUTOLOAD_IPYTHON_EXTENSION=` | Enable or disable IPython extension autoloading. | +| `-X juliacall-heap-size-hint=` | `PYTHON_JULIACALL_HEAP_SIZE_HINT=` | Hint for initial heap size in bytes. | ## [Multi-threading](@id py-multi-threading) diff --git a/docs/src/releasenotes.md b/docs/src/releasenotes.md index 80949200..627d9de5 100644 --- a/docs/src/releasenotes.md +++ b/docs/src/releasenotes.md @@ -1,5 +1,8 @@ # Release Notes +## 0.9.24 +* Added `PYTHON_JULIACALL_HEAP_SIZE_HINT` option to configure initial Julia heap size. + ## 0.9.23 (2024-08-22) * Bug fixes. diff --git a/pysrc/juliacall/__init__.py b/pysrc/juliacall/__init__.py index 6bc61fd4..722b0ea5 100644 --- a/pysrc/juliacall/__init__.py +++ b/pysrc/juliacall/__init__.py @@ -109,9 +109,9 @@ def int_option(name, *, accept_auto=False, **kw): except ValueError: raise ValueError(f'{s}: expecting an int'+(' or auto' if accept_auto else "")) - def args_from_config(): - argv = [CONFIG['exepath']] - for opt, val in CONFIG.items(): + def args_from_config(config): + argv = [config['exepath']] + for opt, val in config.items(): if opt.startswith('opt_'): if val is None: if opt == 'opt_handle_signals': @@ -146,6 +146,7 @@ def args_from_config(): CONFIG['opt_warn_overwrite'] = choice('warn_overwrite', ['yes', 'no'])[0] CONFIG['opt_handle_signals'] = choice('handle_signals', ['yes', 'no'])[0] CONFIG['opt_startup_file'] = choice('startup_file', ['yes', 'no'])[0] + CONFIG['opt_heap_size_hint'] = option('heap_size_hint')[0] # Stop if we already initialised if CONFIG['inited']: @@ -181,7 +182,7 @@ def args_from_config(): CONFIG['lib'] = lib = c.PyDLL(libpath, mode=c.RTLD_GLOBAL) # parse options - argc, argv = args_from_config() + argc, argv = args_from_config(CONFIG) jl_parse_opts = lib.jl_parse_opts jl_parse_opts.argtypes = [c.c_void_p, c.c_void_p] jl_parse_opts.restype = None