mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
awful.spawn.read_lines: Shrink input stream buffer when done (#2289)
I do not know how a GDataInputStream / GBufferedInputStream decides about the size of its internal buffer when reading input by line, but in issue #2288, an example where the output of date (about 30 bytes) was read ten times per second caused ten megabytes of memory usage for this internal buffer. Try to save some memory by explicitly shrinking the buffer size when we are done reading from the stream. Reference: https://github.com/awesomeWM/awesome/issues/2288 Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
b77ffa86e0
commit
13984af8aa
1 changed files with 1 additions and 0 deletions
|
@ -404,6 +404,7 @@ function spawn.read_lines(input_stream, line_callback, done_callback, close)
|
|||
if close then
|
||||
stream:close()
|
||||
end
|
||||
stream:set_buffer_size(0)
|
||||
if done_callback then
|
||||
protected_call(done_callback)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue