[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 12:52:29 -0500 (EST) |
>
>
> --OXfL5xGRrasGEqWY
> Content-Type: text/plain; charset=iso-8859-1
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable
>
> > message_destroy() this will destroy any headers, attributes etc ..
> > that was cache. message_t used a reference count to know when
> > they should deallocate.
>
> Thanks. I read the code of header_destroy to have an idea of what
> these 'owner' fields were, and from that I had the feeling that
> destroy was somehow intended for internal use...
For a header_t the owner is message_t. The owner is the object
that actually created it message_t will create a header_t object
when you do
message_get_header();
It(message_t) needs to keep track of it so when you call message_destroy()
to release any resources.
>
> > 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 ...
>
> In a part of the code, I need to loop over the messages in a POP
> mailbox, so caching is not essential here.
>
Then call message_destroy() every time you do mailbox_get_message().
The memory will be give back.