954,505 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Out Of Memory Problem

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:

TTable *Table_Test;
  Table_Test = (TTable*)(new TMyTable(this));
  // ------ connect tables to CDR Database -------
  ((TMyTable*)Table_Test)->Connection = ptMySqlDatabase;
  ((TMyTable*)Table_Test)->TableName = "test";
  Table_Test->IndexName = "Frame";
  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.

Veli Atci
Newbie Poster
2 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

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?

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

The casts in C++ are a sure sign of trouble.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 
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.

Veli Atci
Newbie Poster
2 posts since Oct 2006
Reputation Points: 10
Solved Threads: 0
 

Have you written the entire code, then it would be better if you post it rather than leave us guessing.

~s.o.s~
Failure as a human
Administrator
11,938 posts since Jun 2006
Reputation Points: 3,281
Solved Threads: 734
 

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.

Salem
Posting Sage
Team Colleague
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
 

When i compile the program it shows the error that OUT OF MEMORY.....
How can i solve it?

Gandharv04
Newbie Poster
1 post since May 2010
Reputation Points: 9
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You