Out Of Memory Problem

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2006
Posts: 2
Reputation: Veli Atci is an unknown quantity at this point 
Solved Threads: 0
Veli Atci Veli Atci is offline Offline
Newbie Poster

Out Of Memory Problem

 
0
  #1
Oct 17th, 2006
Hi,
I am having "Out Of Memory" problem with my program.I am using Borland C++ 5.0.
I have an MySQL type database and trying to access one of its tables.The table which I am trying to access (activate) is around 450 Mbyte.Here is my sample code which gives error:

  1. TTable *Table_Test;
  2. Table_Test = (TTable*)(new TMyTable(this));
  3. // ------ connect tables to CDR Database -------
  4. ((TMyTable*)Table_Test)->Connection = ptMySqlDatabase;
  5. ((TMyTable*)Table_Test)->TableName = "test";
  6. Table_Test->IndexName = "Frame";
  7. Table_Test->Active = true;
At the last line (Table_Test->Active = true;) I get "Out Of Memory" exception error.I have checked with "Windows task Manager",memory usage (Commit Charge) is increasin when program comes to that point and after about 2000Mbyte it raises error.

Do you have any idea to overcome this problem?
Thanks.
Last edited by Salem; Oct 17th, 2006 at 1:52 pm. Reason: Add code tags and remove mistaken smilie
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 1,496
Reputation: WolfPack has a spectacular aura about WolfPack has a spectacular aura about WolfPack has a spectacular aura about 
Solved Threads: 104
Moderator
WolfPack's Avatar
WolfPack WolfPack is offline Offline
Mentally Challenged Mod.

Re: Out Of Memory Problem

 
0
  #2
Oct 17th, 2006
Surely a memory leak. delete the pointer to the table once you are done using it. Are you calling the above code inside a loop?
バルサミコ酢やっぱいらへんで
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Out Of Memory Problem

 
0
  #3
Oct 17th, 2006
The casts in C++ are a sure sign of trouble.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2
Reputation: Veli Atci is an unknown quantity at this point 
Solved Threads: 0
Veli Atci Veli Atci is offline Offline
Newbie Poster

Re: Out Of Memory Problem

 
0
  #4
Oct 17th, 2006
Originally Posted by WolfPack View Post
Surely a memory leak. delete the pointer to the table once you are done using it. Are you calling the above code inside a loop?


Hi,
I am not able to pass that Table_Test->Active=true statement.Error occurs while executing that line.Sure after i finished using it i delete it with delete Table_Test statement.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,610
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 465
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Out Of Memory Problem

 
0
  #5
Oct 18th, 2006
Have you written the entire code, then it would be better if you post it rather than leave us guessing.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Out Of Memory Problem

 
0
  #6
Oct 18th, 2006
What is the relationship between a TMyTable and a TTable ?

Why are you casting?
Casting in C++ usually means you're doing something unwise and possibly dangerous, and that's just what has happened.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC