Hello!
I made a short piece of code that I find very useful for debugging,
and I wanted to ask you if it is correct, somehow acceptable or if I
simply reinvented the wheel.
To deal with some bad bugs caused by memory leaks I ended up with this
simple solution: I made one header file that, when included, replaces
the malloc/calloc/realloc/free functions with some other functions
that do the actual job and insert (or remove) the pointers to the
allocated memory in a list. This way I can catch many errors as double
frees, allocations of zero size, or missing calls to free.
Obviously it works only when a given #define is set (NDEBUG, in my
case).
What do you think about it?
Thank you in advance!
(If you want to see the code I wrote a little page here: http://technicalinsanity.org/out/simplegc/index.html)
Oct 14 '08
33 2875
Richard Heathfield <rj*@see.sig.in validwrote:
>
"When the facts change, I change my mind. What do you do, sir?" - John
Maynard Keynes.
Most people base their facts on their opinions, rather than the other
way around as logic would suggest. :-)
--
Larry Jones
It's no fun to play games with a poor sport. -- Calvin
CBFalconer <cb********@yah oo.comwrote:
>
Which word does not apply to any such C language inclusion. There
is still no mention of threads in the proposed draft of the next
system, and even if it was present it should be shouted down. C
operates in a simple environment, especially in embedded systems,
and nothing that bars that should be proposed.
The current draft is the *very first* draft and contains very little new
material. I can almost guarantee that threads will be prominently
mentioned before the process is complete. Threads and C have been
tightly linked for quite some time: OS kernels, device drivers, and
especially embedded systems are all frequently written in C and
frequently have to deal with multiple threads. Even the current C
standard alludes to threads in the guise of signal handlers. I don't
expect threads to be required, but they need to be discussed so that
people know how to write code that will run reliably when they are
present.
--
Larry Jones
What this games needs are negotiated settlements. -- Calvin la************@ siemens.com wrote:
Richard Heathfield <rj*@see.sig.in validwrote:
>"When the facts change, I change my mind. What do you do, sir?" - John Maynard Keynes.
Most people base their facts on their opinions, rather than the other
way around as logic would suggest. :-)
As much as we might like it to be otherwise, uninterpreted facts are
rarely a sufficient foundation for an opinion. We may strive to make
our 'opinions' (itself a loaded word used to discredit others' thoughts)
conform to an incontestable external reality, but we know it is
ultimately an impossible task.
On Oct 17, 11:33*am, lawrence.jo...@ siemens.com wrote:
Richard Heathfield <r...@see.sig.i nvalidwrote:
"When the facts change, I change my mind. What do you do, sir?" - John
Maynard Keynes.
Most people base their facts on their opinions, rather than the other
way around as logic would suggest. *:-)
I am reminded of this: http://plato.stanford.edu/entries/bayes-theorem/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Maurice |
last post by:
Hi there,
I'm experiencing big memory problems on my webserver. First on an old
RedHat 7.2 system, now on an other fresh installed Suse 8.2 system:
Linux version 2.4.20-4GB (root@Pentium.suse.de) (gcc version 3.3
20030226 (prerelease) (SuSE Linux)) #1 Wed Aug 6 18:26:21 UTC 2003
Apache 1.3.27-41
PHP 4.3.1-52
MySQL 3.23.55-20
|
by: Steve Binney |
last post by:
My code makes synchronous HttpWebRequest and HttpRebResponse calls. In VS
2003, I am getting memory leaks and event handle leaks. I am closing all
streams and using "using"statements. I have used .Net memory profiler from
Sci Tech to analyze the leaks and they are coming from inside HttpWebRequest
and HttpRebResponse. When I run my code on VS2005, I do not get any leaks.
Is this problem fixed in .Net 1.1 SP1? I may not be able to wait...
|
by: Generic Usenet Account |
last post by:
I have been using STL for a long time now, without any problems.
Recently we generated a purification report on our software using
Rational Purify, and we found some memory leaks. My colleague claims
that some of the memory leaks are due to the fact that "STL is wrought
with memory leaks". Of course I disagree. I think that there are no
"inherent leaks" with STL, but if used improperly, leaks will occur.
One common source of leak that...
|
by: Aaron |
last post by:
I just made a web app and there's some memory leak in the code. I can't use
the VS.NET debugger for this. I would like to be able to see what's going on
in the memory. What is the best memory debugging program?
Aaron
|
by: jacob navia |
last post by:
In the C tutorial for lcc-win32, I have a small chapter
about a debugging implementation of malloc.
Here is the code, and the explanations that go with it.
I would appreciate your feedback both about the code and
the associated explanations.
---------------------------------------------------------------------
| |
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?
|
by: bob |
last post by:
hi,
I have a question I should know the answer to.
I've delivered a working set of c++ libraries/dlls that have been
fully tested and validated. Now my problem is that somebody else has
been furiously fixing memory leaks and what not in another DLL that is
used by my own. I suddenly find myself in the situation where MY dll's
are now crashing out and I'm fairly sure, that the fixes in the other
DLL have hosed my stuff. I'm thinking...
|
by: mark Antony |
last post by:
Hi... we are providing software support for one of the famous retailers in U.S. The code has been written in C++. Our field test customers feel that the application software is very slow.
Before we deliver the software to our clients, we are in a urge to improve the performance of the application. Some of our software engineers suspect that the memory dirty pages are too high in the application. They feel that the code have lot of memory leaks....
|
by: graham.keellings |
last post by:
hi,
I'm looking for an open source memory pool. It's for use on an
embedded system, if that makes any difference. Something with garbage
collection/defragmentation would be nice. It should have the ability
to allocate different size chunks of memory not just a single size. It
should error check for double free, etc. And it should be usable by a
mixture of C and C++ subsystems.
If I get that, I'm happy. Thank you very much.
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |