Re: Fwd: memory



boost::shared_ptr is thread safe.


On 5/16/06, Rob Benton <rob benton conwaycorp net> wrote:
I'm pretty sure that...
new calls the "operator new()" function
delete calls the "operator delete()" function
and there are alternate ways of calling new() :

http://www.research.att.com/~bs/glossary.html#Gplacement-new
http://www.research.att.com/~bs/glossary.html#Gnew#
http://www.research.att.com/~bs/glossary.html#Gdelete

As for managing your memory, lots of people will point to one of the
boost smart_ptr's or something similar :

http://www.boost.org/libs/smart_ptr/smart_ptr.htm

But nobody seems to agree on whether or not those are thread-safe.  What
I'm getting at is that Gtk::Manage was meant for widgets.  If you have
objects that are not derived from Gtk::Widget I don't know if that will
help you at all.  Read through the Memory Management section of the
Gtkmm book :

http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch19.html


Ramashish Baranwal wrote:
> Probably this documentation snippet can help-
>
> template<class T>
> T*     manage (T* obj)
>     Mark a Gtk::Object as owned by its parent container widget, so you
> don't need to delete it manually.
>
> Gtk::manage works with classes derived from Gtk::Object, those classes
> whose objects can be 'added' to some parent widget class. If u want
> memory management for any general class have a look at
> boost::shared_ptr.
>
> On 5/10/06, Mickael Drean <mickael drean gmail com> wrote:
>
>> That's what i wanted to say! My question was not about new and delete but
>> more on manage()
>>
>>
>>
>>
>> 2006/5/9, Alex Buell <alex buell munted org uk >:
>> > On Tue, 9 May 2006 21:12:14 +0200, I waved a wand and this message
>> > magically appeared from Mickael Drean:
>> >
>> > > No, i used new() and delete(). I never used manage but i will try to
>> > > use it. Can i use it with my own class object?
>> >
>> > there's only new and delete. There are no functions called new() and
>> > delete()!
>> >
>> > Yes you can. For example:
>> >
>> > Dialog *dialog = new Dialog();
>> > ..
>> > ..
>> > ..
>> >
>> > dialog.run();
>> >
>> > ..
>> > ..
>> >
>> > delete dialog;
>> >
>> > It's that easy.
>> >
>> > --
>> > http://www.munted.org.uk
>> >
>> > Take a nap, it saves lives.
>> > _______________________________________________
>> > gtkmm-list mailing list
>> > gtkmm-list gnome org
>> > http://mail.gnome.org/mailman/listinfo/gtkmm-list
>> >
>>
>>
>> _______________________________________________
>> gtkmm-list mailing list
>> gtkmm-list gnome org
>> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>>
>>
>>
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtkmm-list
>
>





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