Malloc while freeing some object
Giorgos Keramidas
keramida at ceid.upatras.gr
Thu Jun 30 21:09:56 GMT 2005
On 2005-06-30 22:27, Roman Kurakin <rik at cronyx.ru> wrote:
>Dmitry Mityugov wrote:
>>On 6/30/05, Roman Kurakin <rik at cronyx.ru> 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 ;-)
More information about the freebsd-hackers
mailing list