Community mailing list archives


Re: wkhtmltopdf severe memory leak

XOE Corp. SAS, David Arnold
- 29 يوليو, 2016 10:32:16

Interesting indeed, thanks! In our case I can report/confirm swapping activity right after filling up available memory.
Acording to your analysis this could mean:
- Either it's a different beast
- Or GCQ's instances hace a different treatment of malloc(). I don't know the kernel details.

Thanks & Best, David

Jos De Graeve <> schrieb am Fr., 29. Juli 2016 um 03:13:

2016-07-28 22:53 GMT+02:00 Ray Carnes <>:

After increasing the worker  limit_memory_hard parameter to 2GB we have had no further reports of any problems. 


Some extra info here,

We have also seen the issue with wkhtmltopdf.  Indeed, our experience is that with 2GB limit_memory_hard, the problem goes away.

What you must understand is that wkhtmltopdf does a "malloc()" system call for a fairly large amount of memory.  With the standard values of limit_memory_hard you run into trouble with this fairly soon.

Now on the malloc() system call, this does a memory reservation.  On Linux this does not mean that this memory is actually "used"!!  When the linux kernel receives the malloc() system call, it will allocate memory to the process.  When the memory actually gets used by the application, the linux memory manager will allocate physical memory pages for the process.  Only at this moment memory pages are freed from the cache or memory pages from other process might get swapped out to swap areas.

Because of this, wkhtmltopdf can work fine without provisioning large amounts of memory for it.


Jos De Graeve - Apertoso business ICT

Guido Gezellelaan 16 - B-9800 Deinze - Belgium
Direct: +32 9 381 64 51
General:+32 9 381 64 50
Mobile: +32 475 54 68 80
mail/im/skype: - apertoso

Post to: