Click here to Skip to main content
15,909,747 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionReading/editing registry on different .dat file? Pin
LordZoster9-Nov-05 11:40
LordZoster9-Nov-05 11:40 
Questionbinary hex conversion using stacks Pin
OttawaSenator9-Nov-05 6:57
OttawaSenator9-Nov-05 6:57 
AnswerRe: binary hex conversion using stacks Pin
mikanu9-Nov-05 7:12
mikanu9-Nov-05 7:12 
GeneralRe: binary hex conversion using stacks Pin
OttawaSenator9-Nov-05 11:10
OttawaSenator9-Nov-05 11:10 
GeneralRe: binary hex conversion using stacks Pin
mikanu10-Nov-05 16:32
mikanu10-Nov-05 16:32 
Question"please help assignment due soon" Pin
da_comp_learner7-Nov-05 16:07
da_comp_learner7-Nov-05 16:07 
AnswerRe: "please help assignment due soon" Pin
Christian Graus7-Nov-05 16:26
protectorChristian Graus7-Nov-05 16:26 
Questionmemory leak Pin
nineofhearts7-Nov-05 11:37
nineofhearts7-Nov-05 11:37 
my first issue is that i have no idea what is actually happining to cause the leak. To try and find the leak i have commented out most of the code leaving just the basics. First, i create a linked list, then i delete it. thats all thats left of the code. all of the objects of the linked list are deleted and all the nodes are deleted. but something else remains. when i run it, there is a 44 byte memory space still open. my objects are 33 byte (i think). i tried to follow the code as it called new, but was unable to determine who might be calling new and not freeing up.

there are other leaks in the program as well, but i feel that they all resemble this one.
any help or explaination would be greatly appreciated.


int main()<br />
{<br />
//	Memory Leak Debuging Code<br />
	_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF);<br />
	_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);<br />
	_CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);<br />
<br />
	CatagoryPricingLinkedList* cll = new CatagoryPricingLinkedList;<br />
	CatagoryPricing aCat;<br />
	aCat.LoadCat(cll);<br />
        <br />
        delete cll;<br />
        return 0;<br />
}<br />
<br />
<br />
<br />
//CatagoryPricing Node<br />
class CatagoryPricingNode<br />
{<br />
public:<br />
	CatagoryPricingNode(){}<br />
	virtual ~CatagoryPricingNode(){}<br />
	<br />
	virtual CatagoryPricingNode* InsertCatagoryPricing(CatagoryPricing* aCatagoryPricing)= 0;<br />
	virtual void ShowMe()=0;<br />
	virtual void Show()=0;<br />
	virtual CatagoryPricing* GetCatagoryPricing()=0;<br />
	virtual CatagoryPricingNode* GetThisNext()=0;<br />
<br />
<br />
private:<br />
<br />
};<br />
<br />
//internal node<br />
class InternalCatagoryPricingNode : public CatagoryPricingNode<br />
{<br />
public:<br />
	InternalCatagoryPricingNode(CatagoryPricingNode* next, CatagoryPricing* aCatagoryPricing)<br />
	{	<br />
		m_next = next;<br />
		m_CatagoryPricing = aCatagoryPricing;<br />
	}<br />
	~InternalCatagoryPricingNode(){delete m_CatagoryPricing;<br />
									delete m_next;}<br />
<br />
	CatagoryPricingNode* InsertCatagoryPricing(CatagoryPricing* aCatagoryPricing)<br />
{<br />
CatagoryPricingNode* aNode = new InternalCatagoryPricingNode(this, aCatagoryPricing);<br />
		return aNode;<br />
}<br />
<br />
private:<br />
	CatagoryPricingNode* m_next;<br />
	CatagoryPricing* m_CatagoryPricing;<br />
};<br />
<br />
//Tail Node<br />
class TailCatagoryPricingNode : public CatagoryPricingNode<br />
{<br />
public:<br />
	TailCatagoryPricingNode(){}<br />
	~TailCatagoryPricingNode(){}<br />
	CatagoryPricingNode* InsertCatagoryPricing(CatagoryPricing* aCatagoryPricing)<br />
	{<br />
		CatagoryPricingNode* newnode = new InternalCatagoryPricingNode(this, aCatagoryPricing);<br />
		return newnode;<br />
	}<br />
<br />
private:<br />
};<br />
<br />
<br />
//head node<br />
class HeadCatagoryPricingNode : public CatagoryPricingNode<br />
{<br />
public:<br />
	HeadCatagoryPricingNode(){m_next = new TailCatagoryPricingNode();}<br />
	~HeadCatagoryPricingNode(){delete m_next;}<br />
<br />
	CatagoryPricingNode* InsertCatagoryPricing(CatagoryPricing* aCatagoryPricing)<br />
	{<br />
		m_next = m_next->InsertCatagoryPricing(aCatagoryPricing);<br />
		return this;<br />
	}<br />
<br />
private:<br />
	CatagoryPricingNode* m_next;<br />
<br />
};<br />
<br />
class CatagoryPricingLinkedList <br />
{<br />
public:<br />
	CatagoryPricingLinkedList()<br />
{<br />
	m_head = new HeadCatagoryPricingNode;<br />
	pCurrentPtr = m_head;<br />
	m_tail = m_head->GetThisNext();<br />
	<br />
}<br />
<br />
	~CatagoryPricingLinkedList()<br />
		{<br />
			delete m_head;<br />
		};<br />
<br />
	void Insert(CatagoryPricing* aCatagoryPricing)<br />
			{<br />
m_head->InsertCatagoryPricing(aCatagoryPricing);<br />
}<br />
	<br />
private:<br />
	CatagoryPricingNode * m_head;<br />
	CatagoryPricingNode * m_tail;<br />
	CatagoryPricingNode * pCurrentPtr;<br />
	CatagoryPricingNode * temp;<br />
};<br />
<br />
class CatagoryPricing<br />
{<br />
public:<br />
	<br />
	CatagoryPricing(){	<br />
		pricelvl1=0;<br />
		pricelvl2=0;<br />
		pricelvl3=0;<br />
		pricelvl4=0;<br />
		pricelvl5=0;<br />
		costlvl1=0;<br />
		costlvl2=0;<br />
		costlvl3=0;<br />
		costlvl4=0;<br />
		costlvl5=0;<br />
		totalnumbertoorder=0;<br />
		totalinstock = 0;<br />
<br />
		};<br />
	~CatagoryPricing(){};<br />
<br />
	CatagoryPricingLinkedList* LoadCat(CatagoryPricingLinkedList* cll);<br />
private:<br />
//all object members<br />
<br />
};<br />
<br />
CatagoryPricingLinkedList* CatagoryPricing::LoadCat(CatagoryPricingLinkedList* cll)<br />
{<br />
	//initialize local variables...<br />
        //open file for reading<br />
<br />
	CatagoryPricing* aCatagory; <br />
<br />
	do <br />
	{<br />
		aCatagory = new CatagoryPricing;<br />
		<br />
                //inf.get() all info<br />
<br />
                //aCatagory->Set all object variables<br />
               //add aCatagory to linked list<br />
		cll->Insert(aCatagory);<br />
		<br />
		inf.peek();<br />
	}while(inf.good());//end while loop<br />
	<br />
	inf.close();<br />
	return cll;<br />
}<br />

AnswerRe: memory leak Pin
Christian Graus7-Nov-05 12:25
protectorChristian Graus7-Nov-05 12:25 
GeneralRe: memory leak Pin
nineofhearts7-Nov-05 13:21
nineofhearts7-Nov-05 13:21 
GeneralRe: memory leak Pin
Christian Graus7-Nov-05 13:41
protectorChristian Graus7-Nov-05 13:41 
GeneralRe: memory leak Pin
Christian Graus7-Nov-05 13:47
protectorChristian Graus7-Nov-05 13:47 
GeneralRe: memory leak Pin
nineofhearts7-Nov-05 15:59
nineofhearts7-Nov-05 15:59 
GeneralRe: memory leak Pin
Christian Graus7-Nov-05 16:02
protectorChristian Graus7-Nov-05 16:02 
GeneralRe: memory leak Pin
Kevin McFarlane13-Nov-05 4:22
Kevin McFarlane13-Nov-05 4:22 
AnswerRe: memory leak Pin
Joe Woodbury11-Nov-05 20:19
professionalJoe Woodbury11-Nov-05 20:19 
QuestionCallback with &quot;object&quot; parameter fails Pin
TriLogic7-Nov-05 10:39
TriLogic7-Nov-05 10:39 
QuestionC++ console Pin
iamboy7-Nov-05 9:05
iamboy7-Nov-05 9:05 
AnswerRe: C++ console Pin
Christian Graus7-Nov-05 9:50
protectorChristian Graus7-Nov-05 9:50 
QuestionAccessing control from another file Pin
Eran6-Nov-05 22:49
Eran6-Nov-05 22:49 
AnswerRe: Accessing control from another file Pin
Christian Graus7-Nov-05 9:53
protectorChristian Graus7-Nov-05 9:53 
Questionfstream help Pin
afrodriguez6-Nov-05 15:54
afrodriguez6-Nov-05 15:54 
AnswerRe: fstream help Pin
Christian Graus6-Nov-05 15:58
protectorChristian Graus6-Nov-05 15:58 
GeneralRe: fstream help Pin
qfegd8-Nov-05 14:28
qfegd8-Nov-05 14:28 
AnswerRe: fstream help Pin
Jeremy Thornton12-Nov-05 14:03
Jeremy Thornton12-Nov-05 14:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.