473,394 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Simple way to get an effective memory leak

I decided to post here after a little incident where I got an effective
memory leak that was immune from garbage collection.

I created a simple binary tree, no balancing or deleting. Only two
functions from the root--update (add if missing), and read. The
problem was the update had a bug and after updating, it would always
then add as though the item were missing. This caused the tree to grow
unbounded, but from all outward appearances, the program ran normal.

Just pointing out that it is very easy to get an effective memory leak
even with garbage collection.

Apr 13 '06 #1
3 1151
I don't see this as a leak at all, but rather an error in logic? How would
garbage collection catch this? It is assuming you needed those locations, I
would assume.

Jeff

"creator_bob" <ro************@hotmail.com> wrote in message
news:11*********************@i39g2000cwa.googlegro ups.com...
I decided to post here after a little incident where I got an effective
memory leak that was immune from garbage collection.

I created a simple binary tree, no balancing or deleting. Only two
functions from the root--update (add if missing), and read. The
problem was the update had a bug and after updating, it would always
then add as though the item were missing. This caused the tree to grow
unbounded, but from all outward appearances, the program ran normal.

Just pointing out that it is very easy to get an effective memory leak
even with garbage collection.

Apr 13 '06 #2

Jeff Dillon wrote:
I don't see this as a leak at all, but rather an error in logic? How would
garbage collection catch this? It is assuming you needed those locations, I
would assume.

Jeff

My point is that even though memory leaks are all but impossible,
faulty logic can still have the same effect as a leak and still not be
detected. I'm new here; this has probably been discussed many times.
Note the word "effective". I didn't say it was a leak. My point is
that programmers must still be vigilant and not think that things like
this can't happen to them; there are ways to use up memory even with a
garbage collector.

Apr 13 '06 #3
Ah, got it.

"creator_bob" <ro************@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...

Jeff Dillon wrote:
I don't see this as a leak at all, but rather an error in logic? How
would
garbage collection catch this? It is assuming you needed those locations,
I
would assume.

Jeff

My point is that even though memory leaks are all but impossible,
faulty logic can still have the same effect as a leak and still not be
detected. I'm new here; this has probably been discussed many times.
Note the word "effective". I didn't say it was a leak. My point is
that programmers must still be vigilant and not think that things like
this can't happen to them; there are ways to use up memory even with a
garbage collector.

Apr 13 '06 #4

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

Similar topics

6
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that,...
6
by: Scott Niu | last post by:
Hi, I have this following simple c++ program, it will produce memory leak ( see what I did below ). My observation also showed that: There will be a mem leak when all the 3 conditions are true:...
6
by: Nick | last post by:
excuse me!! may i ask a simple problem here? if i dynamically allocate a memory(ex. new in C++ or malloc in C) in a sub-function and forget free the space end of the sub-function. does it...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
7
by: eric | last post by:
hello i'm confused by an example in the book "Effective C++ Third Edition" and would be grateful for some help. here's the code: class Person { public: Person(); virtual ~Person(); // see...
14
by: wahaha | last post by:
Hi, In a small code to implement string copy: while(*a++ = *b++) ; both a and b are char pointers. This code works but at the end, when *a = *b = '\0' finishes, both a and b step one block...
22
by: Simon | last post by:
Hi all, I have a huge memory leak problem in what is really very simple data insert code. In my app I'm trying to use a typed dataset to insert into a database. It adds quite a few rows (say...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.