473,756 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1173
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_bo b" <ro************ @hotmail.com> wrote in message
news:11******** *************@i 39g2000cwa.goog legroups.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_bo b" <ro************ @hotmail.com> wrote in message
news:11******** **************@ j33g2000cwa.goo glegroups.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
3278
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, no memory is lying around. GC reports only 84k of allocations. Starting 5-10 of this apps is going to start taking a considerable amount of memory. Is there a way to reduce this? Tom
6
2566
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: 1. CallControlData does not provide a operator= 2. INUserHandle's operator= returns a object instead of a reference 3. Use CC -g main_leak.C instead of CC main_leak.C to compile. You change any of the above condition, there will be NO mem leak.
6
2516
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 cause memory leak or the space automatically free by OS??
8
3413
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 ? In nut shell, what is/are the realtion/s between the Memory Leak and Memory Corruption. Juts Theoritical Assumtion below:
3
5326
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". Anybody know anything about this? Does *Javascript* leak memeory, or does the *browser* leak memory?
7
3090
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 item 7 for why this is virtual ...
14
1749
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 beyond the last character of the string which is "\0" because of the "++" operation. Will this cause memory leak?
22
2213
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 hundreds). Unfortunately it has a big ass memory leak and I dont understand why. The code below demonstrates the memory leak. It's like nothing is
22
9360
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 memory leak someplace. I can not detect the memory leak by running several reports by hand, but when I run tha app as a servrice and process few hundred reports there is significant memory leak. The application can consume over 1GB of memory where it...
0
9455
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10031
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9869
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9838
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8709
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5140
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.