Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Found a few memory leaks

<< < (2/3) > >>

Game_Ender:
Couldn't we just bring over the header?  I am pretty sure the shared_pointer is contained in a single *.hpp file.  A name space alias and a typedef to cbSharedPointer can even hide the fact that its a boost class.

Der Meister:
No, this was my first idea, too. But this one header has a lot of dependencies. Using just these headers would be much to difficult and error-prone.
Anyway, I don't think that this would solve this one specific problem, because my small implementation seemed to work pretty well. I don't think that it would work with boost::shared_pointer.

mandrav:
Guys, no boost::smart_ptr nor any other smart pointer here please. Plus we 'd then need boost::weak_ptr and so on. wxWidgets don't play well with these, especially in debug versions.
Besides, every object in C::B has a well-known lifetime. There's really no reason for refcounting...

DerMeister, thanks for the effort and the patch. Although it doesn't apply cleanly (it has failed hunks). What I don't get is why you changed all wx containers with their STL counterparts. This is quite a change that is not needed right now. It might even cause more problems in debug versions.
Don't get me wrong: I use STL every day. But I 'm a little reluctant to use it inside wx-based projects...

takeshimiya:
Just something for home made projects, there is a modified boost::shared_ptr that plays nice with wxWindow's here:
http://wxforum.shadonet.com/viewtopic.php?p=26277#26277


--- Code: (cpp) ---#include <boost/shared_ptr.hpp>
typedef boost::shared_ptr wx_ptr;
wx_ptr<wxMessageDialog> ptr(new wxMessageDialog(...));
--- End code ---

About STL containers, there isn't a need for doing the conversion now, but sooner or later there will be a need...
As you may know, wx3 will make use of STL everywhere and even high likely some boost classes.

For anyone interested in the development of wxTNG see here: http://www.wxwidgets.org/wiki/index.php/WxWidgets3

Der Meister:

--- Quote from: mandrav on March 29, 2006, 09:08:38 am ---Guys, no boost::smart_ptr nor any other smart pointer here please. Plus we 'd then need boost::weak_ptr and so on. wxWidgets don't play well with these, especially in debug versions.
Besides, every object in C::B has a well-known lifetime. There's really no reason for refcounting...

--- End quote ---
Well, I guess you're right. These memory-leaks are no real problem as they only appear once during the execution of Code::Blocks. But the only way to solve them would be something like a smart-pointer. But as this is no choice these memory-leaks will probably stay forever. Well, not a problem in this case...  8)


--- Quote from: mandrav on March 29, 2006, 09:08:38 am ---DerMeister, thanks for the effort and the patch. Although it doesn't apply cleanly (it has failed hunks). What I don't get is why you changed all wx containers with their STL counterparts. This is quite a change that is not needed right now. It might even cause more problems in debug versions.

--- End quote ---
Well, I didn't try to apply it to the current revision, maybe there is a problem now. But anyway, as most of the patch is the change from wx containers to stl it should be no problem. Just forget about the patch. The only parts about memory-leaks should be the lines inside the destructors or functions that are called from destructors. Maybe you have to change them a bit to work with wx containers.
The reason why I changed these containers is that I'm not familiar with wx containers but with the stl-containers. But as you and rickg22 already said these change is neither needed nor a really good idea...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version