473,473 Members | 4,176 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

no mem leak but process grows with STL container

Hi,
I have extracted our way to use some STL containers in the following
program:

#include <iostream>
#include <string>
#include <list>
#include <deque>
#include <set>

using namespace std;

int main(int argc, char **argv)
{
// some simple pointers
int* myInt = new int;
*myInt = 7;
int* myInt2;

// the STL containers
std::list<int*> theList;
std::multiset<int*> theSet;

for ( int i = 0; i < 5000; i++ )
{
// fill the list with a number of elements
for ( int j = 0; j < 3000; j++ )
{
theList.push_back( myInt );
}

// do some insert/remove operations on the list
// and allocate some more memory
for ( int j = 0; j < 50 + i*2; j++ )
{
theList.pop_front( );
myInt2 = new int;
*myInt2 = 9;
theSet.insert( myInt2 );
theList.push_back( myInt );
}

// free all the memory except for myInt*
while ( theSet.size() > 0 )
{
delete *(theSet.begin());
theSet.erase( theSet.begin());
}

// clear the list
theList.clear();
}

// free the last bit of memory
delete myInt;
}
This program continuosly grows in size running on Solaris 2.8 with the
Sun Workshop 6.0 CC compiler. However all allocated memory is freed-
there is no memory leakage. The Sun Workshop comes with an STL
implementation from Rogue Wave.
Can anyone explain the process growth?
If this is due to memory fragmentation- why is it fragmenting? The
program is allocating memory chunks of the same size and in the same
sequence with each run of the outmost for- loop?

Thank you for your assistance.

Steffen
Jul 19 '05 #1
0 1954

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jeremy Lemaire | last post by:
Hello, I am working on cross platform code that is displaying a huge memory leak when compiled on 11.00 HPUX using the aCC -AA flag. It is not leaking on NT, LINUX, Solaris, or HPUX without the...
0
by: Steffen Krippner | last post by:
Hi, I have extracted our way to use some STL containers in the following program: #include <iostream> #include <string> #include <list> #include <deque> #include <set>
7
by: shilpi.harpavat | last post by:
Hi, I am trying to allocate more memory if the following condition is true. IS it free of memory leaks?? if(numLevels >= numAlloc) { char **oldLevels = levels; long *oldOrder = order;...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
30
by: MAG1301 | last post by:
I've detected memory leaks in our huge .NET 1.1 C# application but couldn't localize them directly. So I've reduced the code to the following console application: using System; using System.IO;...
0
by: nejucomo | last post by:
Hi folks, Quick Synopsis: A test script demonstrates a memory leak when I use pythonic extensions of my builtin types, but if I use the builtin types themselves there is no memory leak. ...
9
by: jeungster | last post by:
Hello, I'm trying to track down a memory issue with a C++ application that I'm working on: In a nutshell, the resident memory usage of my program continues to grow as the program runs. It...
9
by: Joshua | last post by:
I posted this originally in the csharp group, but I think that may be the wrong group. This seems more appropriate: I'm running into an issue with a memory leak in an Asp.Net web page. In the...
2
by: =?Utf-8?B?SGFubmVzIFN0ZWlua2U=?= | last post by:
Hello, I'm trying to use the command "#pragma omp parallel for" within a thread but each thread that is created (and stopped again) produces a memory leak of about 44kB. If the entry for...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.