[syslog-ng] [PULL REQ]: scratch-buffers

Gergely Nagy algernon at balabit.hu
Mon Nov 7 22:41:28 CET 2011


I've added the finishing touches to the scratch buffer patch, and I
believe it's ready for a merge.

Scratch buffers are a way to store reusable GStrings on a per-thread
basis. They're allocated on demand, and once released, they're not
free'd, but returned to the pool, so the next time the code requests a
scratch buffer, it will reuse an existing one, instead of creating a new
one.

This reduces memory fragmentation, memory use, among other things. It's
also very trivial.

I have prepared a branch for both syslog-ng 3.3 and 3.4 too. The 3.3
branch also updates the value-pairs implementation to use scratch
buffers (and thus, become thread-safe). The 3.4 branch does this too,
and it also updates the json parser similarly.

The branches are available as feature/3.3/scratch-buffers[0] and
feature/3.4/scratch-buffers[1] in my github repo[2].

 [0]: https://github.com/algernon/syslog-ng/commits/feature/3.3/scratch-buffers
 [1]: https://github.com/algernon/syslog-ng/commits/feature/3.4/scratch-buffers
 [2]: git://github.com/algernon/syslog-ng.git

I'm not posting the patches here, as they'd be pretty much the same, and
I've already posted a previous version (and the difference is about 3
lines). Though, if it's easier to review if I post it again, let me
know, it's a git send-email away.

-- 
|8]



More information about the syslog-ng mailing list