Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Sep 2016 13:58:20 +0200
From:      Joerg Sonnenberger <joerg@bec.de>
To:        freebsd-hackers@freebsd.org
Subject:   Re: Is replacing alloca(3) where possible a good thing to do?
Message-ID:  <20160914115820.GA12534@britannica.bec.de>
In-Reply-To: <CABh_MK==e65R%2BEu_ZLBDiF6rKxU1mh83H2TZ9OVhDiaxbKUwig@mail.gmail.com>
References:  <3fe9ba0e-0089-a59c-a09e-8c6f8b74b6bc@openmailbox.org> <CABh_MK==e65R%2BEu_ZLBDiF6rKxU1mh83H2TZ9OVhDiaxbKUwig@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 14, 2016 at 01:46:35PM +0200, Ed Schouten wrote:
> So the best solution is to replace any use of alloca() with
> malloc()/free(). That said, as you were interested in making such
> changes in cddl/*, I guess you'll also have to go through the process
> of sending those patches to Illumos.

Blindly replacing them makes little sense. alloca provides zero-cost
freeing and is also much cheaper than malloc. It should be limited to
reasonable sizes though, where reasonable is typically < 1MB per
thread.

Joerg



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160914115820.GA12534>