simdjson_php
simdjson_php copied to clipboard
Add `simdjson_free_memory(): int`
This may be useful if applications parse megabytes of json on startup, but don't use simdjson for large requests later on.
This would free the buffers used by the underlying C simdjson library
simdjson_warn_unused
inline error_code dom_parser_implementation::allocate(size_t capacity, size_t max_depth) noexcept {
if (this->max_depth() != max_depth) {
error_code err = set_max_depth(max_depth);
if (err) { return err; }
}
if (_capacity != capacity) {
error_code err = set_capacity(capacity);
if (err) { return err; }
}
return SUCCESS;
}
Most of the memory can be freed without this as a workaround by calling simdjson_decode('""')
as a side effect of how the C library is implemented - it will always change the depth/capacity