From owner-freebsd-hackers@FreeBSD.ORG Thu Jun 30 21:09:56 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.org Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5664016A41C for ; Thu, 30 Jun 2005 21:09:56 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.95]) by mx1.FreeBSD.org (Postfix) with ESMTP id B622A43D53 for ; Thu, 30 Jun 2005 21:09:54 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-a160.otenet.gr [212.205.215.160]) by kane.otenet.gr (8.13.4/8.13.4/Debian-1) with ESMTP id j5UL9ahC006380; Fri, 1 Jul 2005 00:09:43 +0300 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.4/8.13.4) with ESMTP id j5UL9UAA001142; Fri, 1 Jul 2005 00:09:30 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.4/8.13.4/Submit) id j5UL9I5s001133; Fri, 1 Jul 2005 00:09:18 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 1 Jul 2005 00:09:17 +0300 From: Giorgos Keramidas To: Roman Kurakin Message-ID: <20050630210917.GB685@gothmog.gr> References: <42C424EA.70306@cronyx.ru> <42C4398C.5060808@cronyx.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42C4398C.5060808@cronyx.ru> X-Mailman-Approved-At: Fri, 01 Jul 2005 11:51:54 +0000 Cc: freebsd-hackers@FreeBSD.org, Dmitry Mityugov Subject: Re: Malloc while freeing some object X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jun 2005 21:09:56 -0000 On 2005-06-30 22:27, Roman Kurakin wrote: >Dmitry Mityugov wrote: >>On 6/30/05, Roman Kurakin wrote: >>> One simple question on programming style. Is it ok to call malloc >>> while we releasing some object? >> >> Are you releasing it in another thread? Is it a C++ object? How are >> you releasing it? > > This was general question. In fact I've found that ttyfree() function > from kernel code allocates tempory variables to free tty. I didn't > expect such behaviour. I always thought that deallocation of smth > should need other alloc. Not necessarily. This could be a problem if you are implementing the allocator itself, and start an infinite recursion or end up deadlocking against the allocator which waits the allocator to finish, which waits the allocator... etc. Users of a general purpose memory allocator don't generally have to worry about the same thing though ;-)