[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: manual memory management

From: Alain Magloire
Subject: Re: manual memory management
Date: Fri, 8 Nov 2002 10:53:32 -0500 (EST)

> Content-Type: text/plain; charset=iso-8859-1
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
> Hi,
> I've another question, this time about memory management. I've seen
> that headers, messages,... have a notion of owner, which is in charge
> of deallocating the resource when it is no more needed.
> I'm working on embedded software, so I have a good motivation to
> understand when memory is released, and possibly to do it myself to
> have the smallest memory footprint... So, is there a way to hint the
> system a header, message,... can be discarded ?

The header are doing aggressive caching.  The simplest way
is when you have finish with an object to destroy it.

message_destroy()  this will destroy any headers, attributes etc ..
that was cache.  message_t used a reference count to know when
they should deallocate.

So doing

        mailbox_get_message(..., 1 , &msg);

        // Do processing on the message, get the headers , attributes etc ..

        message_destroy(&msg, NULL); 

Calling the message_destroy() should give the memory back, not very efficient
in the sense that you clear the caching etc .. but if memory footprint
is more important ...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]