Andrey Rachitskiy <[email protected]> writes:
> Proposed fix:
> Copy only the bytes actually used by the rendered text and free the
> 1024-byte buffer. The point, lseg, box, path, and polygon types are
> rendered via path_encode(). circle_out() builds its own buffer and frees it
> in the same way.

This seems quite myopic.  Those are far from the only datatypes whose
output functions are memory-profligate.  If we wanted to do something
about this, a temporary context similar to what's being discussed in
the adjacent thread about xmlelement() [1] would be a more plausible
answer.

However, I'm resistant to the idea that we need to do something
about this.  It will always be possible to run a backend out of
memory.  If that results in a crash for you, the right answer
is to fix your OOM-killer configuration so you get a clean ENOMEM
error instead [2].

                        regards, tom lane

[1] 
https://www.postgresql.org/message-id/flat/7581277e-e089-417d-867f-8ffd54b9e4c6%40uni-muenster.de
[2] 
https://www.postgresql.org/docs/current/kernel-resources.html#LINUX-MEMORY-OVERCOMMIT


Reply via email to