Re: Exception Misconceptions
In article <4b2d02b2$0$1111$4fafbaef@reader2.news.tin.it>, "io_x" <a@b.c.invalid> wrote:
"tanix" <tanix@mongo.net> ha scritto nel messaggio
news:hgg839$ot7$1@news.eternal-september.org...
In article
<3eacbb7a-4318-4fed-b71c-f5da24cfaf7f@s20g2000yqd.googlegroups.com>, James
Kanze <james.kanze@gmail.com> wrote:
Wasting weeks on cleaning up the memory leaks?
I have wasted MONTHS on trying to catch all the subtle memory
leaks in a sophisticated async based program because of some
network availability issues make you maintain all sorts of
queues, depending on user interaction, causing such headaches,
that you can not even begin to imagine from the standpoint
of memory leaks.
do you know, exist wrapper for malloc, that at end of the program
check if there are "memory leak" and report the result to the screen
Well, I AM getting the leak dumps at the end of the program.
The problem is that we have an issue of the same object being
passed around and saved into several queeues and it is not easy
to say who exactly did not do deallocation. There are several
customers.
I had to add the specific stamp to stamp the packet information,
allocated by the driver interface code. So, when buffer is placed
on unknown packet list and it is not possible to process it until
the user decides what you want to do with it, there is nothing
I can do. The unknown packet dialog is an async code. We can not
block until the user decides to respond to unknown packet.
We have to allow other non issue traffic and allow user to
continue on with ANYTHING related to the program, even if he does
not know what to do with that packet for quite a while,
including the need to issue a whois from the same program and
to see wether he wants to allow this traffic now and in the future.
And that means potential delays in processing for upto minutes.
What if the user went to the kitchen meanwhile and someone
attacks his box? The unknown packet dialog is up, and not only
it is up, but there may be the entire queue of packets that
are waiting to be processed if you are being attacked.
On the top of it, all the processing is asynchronous.
So, the packet buffer, and we carry the whole packet buffer
because user may want do dump the packet buffer to see specifics
of the buffer, has to be carried around and either be attached
to the monitor listbox, or held pending.
And all these mechanisms are not and can not be common.
So, WHO did not release the buffer, when and why?
Try to figure out in totally async environment with several
consumers.
Finally, when I stamped the buffers with the allocator ID tag,
i was able to get read of those memory leaks.
But the whole point is that it wooks months to even decide to
go after this issue and it took days to rewrite the code,
including the NDIS driver before the solution was finally there.
You see the issue?
And I NEVER EVER saw the issue of this kind with Java.
One heavy duty program I wrote in Java works like a champ
for years without a SINGLE issue with memory leak and gc is
so efficient that it is not far from automatic stack deallocation.
And to me, personally, the memory leak issues are some of the
top priority items and it is very unfortunate that this issue
is not resolved to this day in C++.
Sure, you don't have the JVM or MVM to rely upon and the whole
thing becomes quite a trip. But these kinds of things eventually
kill the language for all practical purposes.
Take for example the issue with writing a portable GUI code.
It is a nightmare in C++ environment. Microsoft does it their
way, Linux/Unix does it their way, all sorts of graphit toolkits
do it their way. It is a literal nightmare.
With Java, it is a non issue. And GUI power is one of the most
important criterias in determining the program "correctness".
I do not take a notion of program correctness to be the
formal correctness. Formal correctness can only be proven
mathematically. So, for vast majority of programs out there,
it is nothing more than a pipe dream.
And I am not even using the swing version of GUI.
AWT is just fine for what I am doing and the user interface
is probably the best you can imagine in the wildest dreams.
I could care less about swing. Everything is just fine.
But, because I can use VC, even though it does not support
the "latest and gratest" JDK, I can crank out my code
several times faster than they can do with other development
environments. Plus I can run on any O/S without even recompiling,
and in one case, when my window box got rooted to the point
I could not use it for more than a month because that rootkit
was the most sophisticated thing I even knew exists, that
saved my skin. I just switched to Linux and copied some config
files from win version and restarted the operations at the
same exact point where I lost my windows.
How much does THAT kind of thing count to you?
Well, don't know about you, but this is the number one criteria
for me, and I mean number one, not two or three.
And it is a pitty that C++ can not satisfy either of these morst
critical elements for me.
And I saw plenty of posts by different people and their opinions
on it, and it basically lead nowhere. No progress so far that
I know of in none of the most critical areas of modern programming
languages. Even stinky Javascript does not have as many portability
prblems as C++. What a pitty!
so memory leak can not be one problem if one use these special "malloc"
functions (like i use always with all bell that sound)
Not do worry, I did all of that.
The point is how much time and energy you have to waste to bother
with stoopid things like memory leaks?
Saluti
--
Programmer's Goldmine collections:
http://preciseinfo.org
Tens of thousands of code examples and expert discussions on
C++, MFC, VC, ATL, STL, templates, Java, Python, Javascript,
organized by major topics of language, tools, methods, techniques.