diff options
author | Ruediger Pluem <rpluem@apache.org> | 2022-01-18 20:13:29 +0000 |
---|---|---|
committer | Ruediger Pluem <rpluem@apache.org> | 2022-01-18 20:13:29 +0000 |
commit | e530aaaf8c4801d06da1b655caa284adf6eda9e5 (patch) | |
tree | ff4f8f2d6eb04650f35707d7ec254f8cf85898f6 /modules/dav | |
parent | c51dccd833ccaec00df9420701c879ca6fb0e3b4 (diff) | |
download | httpd-e530aaaf8c4801d06da1b655caa284adf6eda9e5.tar.gz |
* Allocate the dav_liveprop_elem structure only once in the lifetime of the
resource->pool and reuse it to avoid unnecessary huge memory allocations
during collection walks.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897182 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/dav')
-rw-r--r-- | modules/dav/main/props.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/dav/main/props.c b/modules/dav/main/props.c index dc5e5b7472..e1b6815cc8 100644 --- a/modules/dav/main/props.c +++ b/modules/dav/main/props.c @@ -805,9 +805,15 @@ DAV_DECLARE(dav_get_props_result) dav_get_props(dav_propdb *propdb, /* we lose both the document and the element when calling (insert_prop), * make these available in the pool. */ - element = apr_pcalloc(propdb->resource->pool, sizeof(dav_liveprop_elem)); + element = dav_get_liveprop_element(propdb->resource); + if (!element) { + element = apr_pcalloc(propdb->resource->pool, sizeof(dav_liveprop_elem)); + apr_pool_userdata_setn(element, DAV_PROP_ELEMENT, NULL, propdb->resource->pool); + } + else { + memset(element, 0, sizeof(dav_liveprop_elem)); + } element->doc = doc; - apr_pool_userdata_setn(element, DAV_PROP_ELEMENT, NULL, propdb->resource->pool); /* ### NOTE: we should pass in TWO buffers -- one for keys, one for the marks */ |