Skip to content

Clean up pointers to middle_query_t in outputs to release memory#1567

Merged
lonvia merged 2 commits intoosm2pgsql-dev:masterfrom
joto:fix-memory-release
Sep 5, 2021
Merged

Clean up pointers to middle_query_t in outputs to release memory#1567
lonvia merged 2 commits intoosm2pgsql-dev:masterfrom
joto:fix-memory-release

Conversation

@joto
Copy link
Copy Markdown
Collaborator

@joto joto commented Sep 3, 2021

The outputs have a shared pointer to the middle_query_t to access the data held by the middle. This in turn holds pointers to potentially large datastructures and the flat node file. We need to release those pointers after we don't need them any more so that if and when the middle doesn't need those data structures any more they get cleaned up.

In effect this releases the memory used for the cache and flat node store earlier.

Fixes #1563

The second commit cleans up the code a bit using a proper accessor in output_t to access the mid pointer.

joto added 2 commits September 3, 2021 09:30
The outputs have a shared pointer to the middle_query_t to access the
data held by the middle. This in turn holds pointers to potentially
large datastructures and the flat node file. We need to release those
pointers after we don't need them any more so that if and when the
middle doesn't need those data structures any more they get cleaned up.

In effect this releases the memory used for the cache and flat node
store earlier.

Fixes osm2pgsql-dev#1563
@lonvia lonvia merged commit a50c54e into osm2pgsql-dev:master Sep 5, 2021
@joto joto deleted the fix-memory-release branch October 23, 2021 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory released too late for the main cache ?

2 participants