Home » U++ Library support » U++ Core » Why this one leaks ?
Re: Why this one leaks ? [message #33767 is a reply to message #33766] |
Sun, 11 September 2011 17:22   |
 |
mirek
Messages: 14267 Registered: November 2005
|
Ultimate Member |
|
|
mdelfede wrote on Sun, 11 September 2011 11:07 |
#include <Core/Core.h>
using namespace Upp;
class Base : public Pte<Base>
{
public:
String BaseData;
Base() { BaseData = "Sample data in Base class"; }
};
CONSOLE_APP_MAIN
{
Ptr<Base> b = new Base;
}
Shouldn't be created element freed on Ptr destruction ?
Here the Upp log :
|
You got it wrong way. b is set NULL on Base destructoin, not other way around.
U++ deliberately stays away from "smart pointers" used to manage shared resources.
Mirek
[Updated on: Sun, 11 September 2011 17:22] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue Aug 26 15:21:21 CEST 2025
Total time taken to generate the page: 0.04911 seconds
|