?
Solved

Memory Leak Problem with Borland 5.0.1 Multithread Libraries!

Posted on 1997-05-01
2
Medium Priority
?
450 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 600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
Suggested Courses

752 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