WIP: first stab at making Postgres MemoryContexts easier to use. #82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Perhaps this might could replace
PgAllocator
given more work.The idea here was to come up with an API that's a little more natural to working with PG in C, as it relates (at least) to dealing with memory contexts.
In any given function exposed Rust function, it might look something like this:
Alternatively, you could just allocate some PG memory directly in a context:
None of this is related to how Rust allocates memory, of course. Rusts normal rules for its allocated bytes would apply. I haven't really yet through through how to reassign ownership of Rust allocated memory to a particular Postgres MemoryContext, but I'm not sure that's even a useful thing -- any memory we want PG to hold on to needs to be allocated by PG anyways.