Solved

Memory Leak Problem with Borland 5.0.1 Multithread Libraries!

Posted on 1997-05-01
2
438 Views
Last Modified: 2013-12-14
Hi there -

I have a memory leak problem with an HTTP server application that is written using Borland C++ 5.0.1. It runs fine when compiled as a single threaded app.

The memory leak shows up when the app is compiled with the
multi-threading option enabled even though there are no other threads being explicitly created.

We can reproduce the error with the following 12 lines of code:

// -------- Begin test code --------

// Test for memory leak with Borland 5.0.1 and Windows NT4.0 SP2

// Compile this without the multithread option and everything is fine.

// Compile with the multithread option (under TargetExpert),
// and it leaks memory rather quickly.

#pragma hdrstop
#include <vector>
#include <string>

main() {
   while(true) {
      std::vector<std::string> vect;
      for (int i = 0; i != 10; i++) {
        vect.push_back("Quack");
      };
   };
};

// -------- End test code --------

0
Comment
Question by:david.april
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
gaohong earned 200 total points
ID: 1163161
Do you use STL or you just give the example to show Multi thread
leaking. If you do not use STL, then you could use something
else to check the leak is from STL or multithread. If it from
multithread then you have no choice, except contact Borland, wait
for BC++5.2. If it is from STL, you might do something by either
using your own vector container or other version of STL.

hope this can help
0
 

Author Comment

by:david.april
ID: 1163162
I am using STL (Borland's) and that appears to be where the problem is. I have since downloaded SGI's STL implementation (actually the additional port from Boris Fomitchev's page at
http://www.ipmce.su/people/fbp/stl/stlport.html) and am trying to see if it makes a difference.

FWIW, Borland has indicated that this problem is not fixed in BC5.2, but a tech there is also looking at their STL source to dig into it more.

Dave
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question