yes. David you don't need to bother with this program. few hours ago, I took a detour from Modern Operating Systems to Programming with POSIX Threads to get a better understanding about threads. I apologize for the trouble.
I don't really see how your code can leak more than one block of memory when the entire program only allocates one!? Those leaks must be elsewhere - if those leak messages are indeed correct.
I suspect that the pthread library internally uses some kind of memory pool that doesn't get freed before the end of the program. I've seen the same thing in a CAD library that produces tens of thousands of "leak" messages because of that. It's very annoying becasue that way it's extremely difficult to pinpoint actual leaks, or find out if there even is one.
Well, if my assumption is correct, technically these aren't leaks - they just appear as such because memory pools are designed that way. If used correctly, these 'leaks' will not be a problem, except when it comes to the problem of locating real leaks.
Memory pools are used as a faster way to allocate and free lots of small blocks of memory. Basically they take up the role of a memory manager for specific types (or sizes) of objects. They may be capable of freeing unused blocks at runtime (reducing the number of "leak" messages), but doing so complicates the management effort considerably. As a consequence, most implementations never free blocks at runtime, they only grow when running out of free memory within already allocated blocks. That means the total cost of memory is the maximum load at runtime.
Just in case someone wonders, it was written in the book Programming with POSIX threads (the book I mentioned earlier), that we don't need to destroy (with pthread_mutex_destroy()) a mutex initialized statically i.e. with PTHREAD_MUTEX_INITIALIZER. Thank you people for all the attention given to this topic
I did follow this discussion which started badly – no real info was provided on the initial post, almost got into personal fist fight - “nobody spoon-fed me knowledge about programming” and ended up with no real solution to learn from.
I often wonder why people waste their time posting stuff like this.
… off my soapbox now...
I plan to develop a new application with Visual C++ but I am wondering which library to use for the GUI design. I.e. MFC, QT.. and so forth.
MFC is a native MS library and sounds nice but rumors say that it has no future.
What are your thoughts?
Would you start a new application with MFC?
I use VC 6.0 MFC, but I am a retired (cheap) hobbyist. I like the doc/ view “feature”.
It was suppose to simplify the windows messaging, but it made it more complicated.
May "professionals" will say that MFC lets you build quick base UI for your application, but IMHO it is a shaky foundation to build onto, adding anything requiring more that friendly, quick user interface application is a challenge using MFC.
That is why, again in my opinion, you see mostly dialog based sample codes here.
The key is in detailed planning – what do you want your app to accomplish.
And as far as future of MFC – I see a continuing trend to abuse “object oriented” hiding of the actual process and “foundation” is just another name for “wrapper”.
In short – do not use MFC if you want true control of your code.
MFC is burdened with several decades of legacy, and full of bad designs and ugly interfaces. You won't notice a lot of it when designing a small GUI project, but for serious, long-lived work, it is most certainly not a good choice.
However, your choice depends a lot on the application you plan to build:
- If you want to build one for the MS App Store, you probably have to build it on the basis of WinRT, not MFC.
- If you want one that runs on Win7, WPF is a better, more modern library than MFC.
- If in the long (or short) run you don't want to restrict your application to just Windows, you need a platform-independend framework like QT.
For cross platform, Qt is probably the most dominant library.
For just Windows, .NET is the most dominant, though the actual UI jumps around (forms, XAML, Silverlight, etc.)
I personally love C++ and MFC and write small apps in both because I'm an expert in both (and will hopefully retire soon with that being my legacy of expertise.) However, if you are starting out, unless you are specifically interested in embedded systems, driver or kernel level code, C++ is a poor choice. Based on my recent interview experiences, Java probably has more demand than any language (Android is a big part of this) with C#/.NET web services being a close second. I have found increased interest in Qt, though I'm not convinced the demand will last much more than another decade, if that.
(On the flip side, iPhone apps are written in Objective-C. How long will that last? Who knows?)
I have given up on integrating MFC with VFW and embarking on usage of DirectX to collect data from USB video cameras.
I have found other sample code ( using MFC and VFW) and it behaves exactly the same way as my attempt to make it work.
I suspect that the issue is with my current ( and latest XP ) driver.
Besides getting used to confusing terminology – DirectX, DirectShow I have run into my first problem while using the sample code posted elsewhere here.
There seems to be MS specific and also VS release specific header sal.h ( or later sal2.h).
I have downloaded latest Windows SDK and this file is not there.
The “problem“ I am facing is that the file / header is defined in several VS versions, but than it also depended on other headers, as usual.
<b>I guess my silly question is – can these language additions , such as sal.h, by MS be downloaded individually from reputable source and not as a part of say VS 2010? </b>
The MS description lacks the “download from here” options.
As “painful” as it is I have no issue with creating my own headers dependencies.
Any reasonable advise will be as always appreciated.
As a side note, I would just say that you are making the right decision. VFW is a dead end these days and DirectShow is a better option. Microsoft Media Foundation[^] is actually the next generation, replacing DirectShow. It requires Windows Vista or newer, so if you have requirements that includes using Windows XP, don't go down that route yet .
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
thanks for the note. I have been hearing this “dead VFW” since I first started asking about it.
My “standard” reply - “popular” OpenCV is based on VFW! The “problem” is that people are just cutting and pasting all of the VFW sample codes (posted here and elsewhere) and NOBODY really knows how it works as a real event driven Windows API! You can always find a”timer” or infinite “loop” somewhere in these samples – including in OpenCV basic code sample.
As soon as I get this “sal.h” in, I am off and running!
PS My last name is Sal!
PS How may developers are "building " for Vista? or ME? I'll wait for Windows 10.
Last Visit: 31-Dec-99 19:00 Last Update: 28-Nov-23 13:42