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.

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?

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.

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

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.

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

commented: By not bumping old threads -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.