U++ framework
Do not panic. Ask here before giving up.

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 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14291
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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: read/write to pipe /dev/rtp..?
Next Topic: Array : swapping element with a pointer
Goto Forum:
  


Current Time: Mon Sep 14 11:24:15 GMT+2 2026

Total time taken to generate the page: 0.00630 seconds