944,048 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 6171
  • C++ RSS
Oct 17th, 2006
0

Out Of Memory Problem

Expand Post »
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:

C++ Syntax (Toggle Plain Text)
  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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Veli Atci is offline Offline
2 posts
since Oct 2006
Oct 17th, 2006
0

Re: Out Of Memory Problem

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?
Moderator
Reputation Points: 572
Solved Threads: 115
Mentally Challenged Mod.
WolfPack is offline Offline
1,559 posts
since Jun 2005
Oct 17th, 2006
0

Re: Out Of Memory Problem

The casts in C++ are a sure sign of trouble.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Oct 17th, 2006
0

Re: Out Of Memory Problem

Click to Expand / Collapse  Quote originally posted by WolfPack ...
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Veli Atci is offline Offline
2 posts
since Oct 2006
Oct 18th, 2006
0

Re: Out Of Memory Problem

Have you written the entire code, then it would be better if you post it rather than leave us guessing.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 720
Failure as a human
~s.o.s~ is offline Offline
8,873 posts
since Jun 2006
Oct 18th, 2006
0

Re: Out Of Memory Problem

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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
May 29th, 2010
-2
Re: Out Of Memory Problem
When i compile the program it shows the error that OUT OF MEMORY.....
How can i solve it?
Reputation Points: 9
Solved Threads: 0
Newbie Poster
Gandharv04 is offline Offline
1 posts
since May 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: searching a bst
Next Thread in C++ Forum Timeline: copying from string





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC