Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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: 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

 
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: Tue Aug 26 15:21:21 CEST 2025

Total time taken to generate the page: 0.04911 seconds