Insufficient memory to perform operation

I have a Windows Forms program written in Visual Studio 2005 that's throwing an out of memoery exception when I try to place a pushpin on a MapPoint map, even though we just added a few Magabytes RAM to the machine.  So I think this means my program has a memory leak.

Is that a good assumption?

If so, what kinds of things should I look for in the program to track it (or them) down??

In the descroy method I do not do much at all.

Oddly, the memory load is flat at 27% and was pretty low when my program crashed and generate the low memory exception.

ANy help would be greatly appreciated.  This is a test system that's about to be sold if I can remove these instalbility issues.

thanks,
newbieweb
newbiewebSr. Software EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BradyPrincipal Data EngineerCommented:
Try searching your code for thinhs like tmemorystreams and tstringlists and files that you have created but not freed.  Search for anything that loads into memory and make sure you free them either in the procedure[s] or when closing application depending on your needs.

Elvin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
newbiewebSr. Software EngineerAuthor Commented:
Does an ArrayList need to be freed?  I use ArayLists everywhere!
0
Mark BradyPrincipal Data EngineerCommented:
I'm not sure about that one.  Sorry I can't answer.
0
newbiewebSr. Software EngineerAuthor Commented:
> Try searching your code for thinhs like tmemorystreams and tstringlists and files that you have created but not freed.  Search for anything that loads into memory and make sure you free them either in the procedure[s] or when closing application depending on your needs.

Could you explain "loads into memory"?
0
Mark BradyPrincipal Data EngineerCommented:
What I meant by that is things like TmemoryStreams and strings, stringlists etc when created and filled with data load into memory (not onto hard drive).  Strings and other variables inside procedures stay in memory until the procedure ends.  TmemoryStreams once created will stayt in memory untill released.  So for eg if you created a memorystream and used it to read a large file, it will load that file data into memory.  Once you finish using it, you should release it from memory with the 'free' command.

example:    // This procedure opens a file on disk into a memory stream.

procedure TForm1.Button1Click(Sender: TObject);
var fs: TFileStream;
    bt: Byte;
begin
  fs := TFileStream.Create('C:\logo.jpg', fmOpenRead);
  try
    while fs.Position < fs.Size do begin
      fs.Read(bt, 1);
     Memo1.Lines.Add(IntToHex(bt, 2));
      // turns each byte in the stream into a hex value and adds it to a TMemo //
    end;
  finally
    fs.Free;   //   <----    This is where the memorystream is freed  
  end;
end;
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.