Re: [dev] Re: [dmenu] [patch] add xft and fix possible memory leak in version 4.2.1

From: Connor Lane Smith <>
Date: Sun, 21 Nov 2010 13:02:34 +0000


On 21 November 2010 03:56, Dan Brown <> wrote:
> 2) dmenu v4.2.1 appears to be leaking memory. It is missing the
> routines to teardown/cleanup memory structures present in previous
> versions. This patch also adds them.

As Wolf says, there is no memory leak: there are only mallocs right at
the start, and no opportunities to free until the moment before dmenu
exits (which tears down the entire process space anyway).

On 21 November 2010 08:11, Anselm R Garbe <> wrote:
> Well for clarity and consistency reasons I prefer if dmenu cleans up
> all resources acquired at the end. So that cleanup() was removes looks
> more like a bug to me and thanks to Dan for pointing this out.

It was intentional. It is not even possible for there to be a memory
leak, so all we get is a slower dmenu with more complex code, with
absolutely no benefit. The more items there are the slower it gets,
and most of the heap doesn't get freed until exit anyway. cleanup() is
like sweeping the floor for the apocalypse.

On 21 November 2010 03:56, Dan Brown <> wrote:
> 1) Attached is a patch that enables xft fonts in dmenu 4.2.1.

There has been a discussion about Xft fonts in dmenu before [1]. I
haven't come to a decision myself. Is there really not a way to add
Xft support without making huge changes to the code to compensate?

Also when I applied your patch and tried to run 'dmenu -fn fixed' I
instead got some sans-serif font..?


Received on Sun Nov 21 2010 - 14:02:34 CET

This archive was generated by hypermail 2.2.0 : Sun Nov 21 2010 - 14:12:02 CET