How Far Should You Go To Use Valgrind?

This is a discussion on How Far Should You Go To Use Valgrind? within the C++ Programming forums, part of the General Programming Boards category; Valgrind is the most important thing I miss on Windows. Feature list: Valgrind: Tool Suite I've only used memcheck part ...

  1. #16
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Valgrind is the most important thing I miss on Windows.

    Feature list:
    Valgrind: Tool Suite

    I've only used memcheck part myself.

    My programs are all cross-platform, so I always develop on Linux, mostly because of valgrind, and better supported GNU stuff (gcc/gdb/gprof/make).

  2. #17
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Valgrind does much more than leak detection
    Memcheck can detect if your program:

    * Accesses memory it shouldn't (areas not yet allocated, areas that have been freed, areas past the end of heap blocks, inaccessible areas of the stack).
    * Uses uninitialised values in dangerous ways.
    * Leaks memory.
    * Does bad frees of heap blocks (double frees, mismatched frees).
    * Passes overlapping source and destination memory blocks to memcpy() and related functions.

  3. #18
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by Elysia View Post
    doesn't mean others should
    Sigh, I believe in this case that's exactly what it means.

    Quote Originally Posted by Elysia View Post
    choose an operating system depending on your needs and your preferences.
    Exactly. Did you not read his requirements? Let me refresh your memory. He wants to debug memory, and doesn't want to spend money. Valgrind is a great solution. I'm not saying he has to throw away Windows. Run Windows inside Linux, or run Linux inside Windows. Either way, neither is equivalent of throwing away your computer. That's utter nonsense. Switching to Linux exclusively for Valgrind is illogical though, but learning Linux would help him grow as a programmer, and much more. It's not something to be avoided. It's something to embrace. Valgrind is a bonus.

    Quote Originally Posted by steals10304 View Post
    I'm running windows. It looks like Valgrind is for a linux box. Also, I'm a student and don't want to buy anything.
    A + B = Valgrind on Linux. I don't know why it's so hard for Elysia to see this.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  4. #19
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,246
    "learning Linux would help him grow as a programmer"

    What? O_o

    Yog Sothoth! There's a lot of garbage in this thread.

    Anyway, if you find yourself needing a *nix development environment you don't have to switch or virtualize your way to it. Just grab yourself a "Live" disc and develop away.

    Soma

  5. #20
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    learning Linux would help him grow as a programmer
    So will finding a cave and meditate for a month (thinking about programming). But that's not a terribly efficient way.

    Learning a new OS sure is fun and useful, but may not be an efficient way to further programming knowledge.

  6. #21
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,587
    Quote Originally Posted by jeffcobb View Post
    ..and static analysis and code coverage and code profiling and ...
    Free version doesn't have them, but they are there... in more expensive versions.

    But you are right: the free edition is not listed here but since these are the paid-for editions you can count on the free edition having even less and the user has to pony up 300 bones just to get the minimum functionality listed here...
    Unless you're a student
    See the Team System in my sig? I got it for free because I am a student.
    For non-college students, you can get the Professional version for free.

    As for the rest of your remarks waaay back I said the "reformat" comment was in jest...I know no Windows programmer is going to use another environment to get better tools for free...how else are they going to play Warcraft and other games?
    Yes, well, you should make it easier to spot your jest.

    Quote Originally Posted by jeffcobb View Post
    Oh and if I remember correctly I needed to do 64-bit development for a CAD company to support their 64-bit product. It was *possible* but not made easy by the crippled express edition....

    Edit: now that I look back at it, you did not get MFC or ATL either...
    64-bit support should be in the free version, but not MFC (ATL I don't know about).

    Quote Originally Posted by Dae View Post
    Sigh, I believe in this case that's exactly what it means.

    Exactly. Did you not read his requirements? Let me refresh your memory. He wants to debug memory, and doesn't want to spend money. Valgrind is a great solution. I'm not saying he has to throw away Windows. Run Windows inside Linux, or run Linux inside Windows. Either way, neither is equivalent of throwing away your computer. That's utter nonsense. Switching to Linux exclusively for Valgrind is illogical though, but learning Linux would help him grow as a programmer, and much more. It's not something to be avoided. It's something to embrace. Valgrind is a bonus.

    A + B = Valgrind on Linux. I don't know why it's so hard for Elysia to see this.
    In this case, it's about abandoning Windows and going for Linux. And for a couple of programming tools, that's a huge step. Linux is completely different from Windows.
    Running a virtual machine or running Linux inside Windows is not as extreme and is not something to be afraid of. That is a good alternative.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by cyberfish View Post
    Learning a new OS sure is fun and useful, but may not be an efficient way to further programming knowledge.
    Not nearly so much as say, studying another language would (I guess, since I only use one OS).

    I don't know if using and understanding multiple operating systems will improve your programming skills automatically, except to the extent that it may provide some perspectives and tasks, etc (again, since I don't do that, I can't say).

    But it would -- by definition -- increase your knowledge of computer science. Like, I would assume it is pretty much required of contemporary CS majors to have some working knowledge of a *nix environment. Otherwise you are not really doing a "computer science" degree, you are doing a "microsoft science" degree.

    Like, I've never written a stitch of code on or for a windows machine, so I am pretty ignorant about the OS. If I were going to make a study of operating systems, I guess it would have to be plural. But in the meantime, not doing this probably does not affect "how I program" in any specific way -- it just affects my knowledge of "the context of programming".

    Ie, I don't see why a computing student would not want to make use of linux.* It came from computer science students and enthusiasts who wanted the opportunity to use a UNIX platform at home without have to pay the $2000+ price tag AT&T or Sun charge (and further, to have access to the OS source code, which is not something you could buy from AT&T, Sun, or MS at any price).

    * well, beyond being a stubborn or lazy fool (the "C--" degree).
    Last edited by MK27; 02-24-2010 at 08:10 AM.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  8. #23
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Quote Originally Posted by Elysia View Post
    Linux is completely different from Windows.
    No, it isn't. For the purpose of the OP, it's nearly the same. Stuff in a CD, install, boot, you have pretty windows floating around. Then you start the software manager, find an IDE that fits your environment (Anjuta for Gnome, KDevelop for KDE), install it, launch it, and there you are. I'm pretty sure one or both of them even support launching the app under development in valgrind.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #24
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,587
    That is what I would expect to hear from someone who hasn't used Linux.
    Sure, for the purposes of programming, this may be sufficient, but that is not enough if you would use Linux for everything else. Because, simply, Linux is not Windows. They operate on different principles.
    Dumping Windows for Linux or vice versa for some tools is ridiculous. Installing and using some virtual Linux or something like that may be a good idea, if you feel comfortable doing that.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #25
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by cyberfish View Post
    Learning a new OS sure is fun and useful, but may not be an efficient way to further programming knowledge.

    I disagree. Perhaps it's a learning curve, but it's worth it. I find the way it's laid out is like a gift to technical people (and therefore programmers). Let me see, almost everything is command-line operated (and therefore can be programmed); more efficient file structure (little/no defragmenting); most Windows alternatives feel like disorganized hacks and wrappers from multiple developers over 15 years; more networking freedom (select() anyone? yay for Windows hacking it in what.. Vista? great); sockets among other things are file descriptors and easier to work with and understand; none of that dreadful registry crap; forking processes can be as efficient as threads whereas Windows is just inefficient; Windows GUI freezes and you're screwed, but *nix GUI isn't tied to the OS - it just fades and you continue operating; you want to upgrade DirectX? buy, upgrade and learn an entirely new Windows, bloody brilliant;

    When I used Windows exclusively, it was like dragging around a ball and chain. I feel free now. Coming back to Windows, I do feel a bit more perceptive to what's going on in the background, and that's due to my previous ignorance for sure, but I still feel burdened. Programmers should be learning cross-platform and open source methodology for the good of the world, and ween our dependency on proprietary Windows and Windows specific software. There's no just reason for it. I would be happy with making Windows a *nix distro, instead of copy and pasting all *nix features to Windows like we've been doing the last 20 years.

    Please, stop using Windows registry. Thank you.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  11. #26
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,587
    The Windows registry is handy due to several reasons I'm sure Microsoft mentioned. The funny thing is that Microsoft themselves are backing out on their own advice. Don't use XML files. Use the registry on Windows.
    It's safer, and usually faster, among other things.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #27
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    Quote Originally Posted by phantomotap View Post
    "learning Linux would help him grow as a programmer"

    What? O_o

    Yog Sothoth! There's a lot of garbage in this thread.

    Anyway, if you find yourself needing a *nix development environment you don't have to switch or virtualize your way to it. Just grab yourself a "Live" disc and develop away.

    Soma
    What? Obviously this guy needs to get out more or use what he advises; for one thing developing with a live CD is insane because even with a writable USB key you are going to have a slow, hard time of it. The general work of coding and debugging generates lots of files and ram-discs and keychain drives are only going to hold so much and be accessed so fast...

    And yes learning a new OS *will* help him/her grow as a programmer because at least half of the jobs out there now are Windows and half of some form of UNIX. Cell phones, embedded devices, set top boxes and large mission critical data centers are using it and need coders. But more than that as any coder who has spent any time working in both environments will tell you, knowing how things work at a deep level is a great education and you will learn more about how operating systems work from Linux than you ever will from Windows for the simple reason that Windows keeps it locked up whereas all of the source to any version of the Linux kernel is available to anyone wanting to look and to learn. Is it the best OS? Maybe so and maybe not but that is something we will never know because we cannot compare the Windows source with Linux source. Ever.

    The thing is most folks arguing for Windows here have spent little time in the other camp. On the other hand I would venture a guess to say that most folks arguing for Linux have already done there time in Windows development as I have. Thus the reader must weigh speculation vs experience....
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  13. #28
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,246
    Obviously this guy [...] have a slow, hard time of it.
    Obviously you need to speak to someone with less experience.

    One of my development machines is disc-less. I use a live disc plenty.

    You can mount a partition and use the native disc drive with a live disc. (I don't. I'm just offering the information.)

    Perhaps it's a learning curve, but it's worth it.
    Who said that learning a new OS wasn't worth it? Learning anything new is great. It keeps the brain from turning stale!

    Learning a new OS or a new language will not help anyone become a better programmer. You may as well say learning a new library will make someone a better programmer. It will not. Such practices will, at best, teach them to use the OS, the library, the language, the technique, etc.. The time spent at the beginner level of these "tools" could be spent mastering, or at least advancing, what one is already comfortable with.

    Using the Linux kernel source to study programming is impossible. Using the Linux kernel source just to study kernel programming is impossible. It is too large. It, the source, is too poorly designed. You'd have to be a master C programmer, with hardware experience, to understand it.

    Cell phones, embedded devices, set top boxes and large mission critical data centers are using it and need coders.
    Cell phones, embedded devices, set top boxes and large mission critical data centers are using *Java* and need coders.

    Cell phones, embedded devices, set top boxes and large mission critical data centers are using *OCaml* and need coders.

    Cell phones, embedded devices, set top boxes and large mission critical data centers are using *SQL* and need coders.

    Cell phones, embedded devices, set top boxes and large mission critical data centers are using *Python* and need coders.

    Cell phones, embedded devices, set top boxes and large mission critical data centers are using *Windows* and need coders.

    Yay!

    Seriously though, what does this have to do with making better programmers?

    Thus the reader must weigh speculation vs experience...
    Okay. Here is 23 years experience programming and teaching programming speaking: learning to use GNU/Linux as a host operating system does ........ all for people learning programming.

    Advocating a switch to a free operating system is great. (Beleive me, I'd be more than happy to use my LFS exclusively if I could get native support for all of my laptops.) Granted, you aren't even really advocating open source software.

    Suggesting widely available tools to help with programming is great.

    You only got my attention because you waved the promise of "better programmer" at a newbie if he would learn to use a different host operating system.

    The thing is most folks arguing [...] time in Windows development as I have.
    ^_^

    You are doing nothing more and nothing less than what Elysia is doing.

    You are advocating your preference with a dance of lies.

    Soma

  14. #29
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Quote Originally Posted by Elysia View Post
    That is what I would expect to hear from someone who hasn't used Linux.
    That's pretty rich, coming from you. Believe me, I use Linux a LOT. Almost exclusively at home; I only launch Windows for playing games. I use Windows for programming at work. So I know both environment very well. And I'm telling you, there is no significant difference in the day-to-day programming work.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #30
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,587
    The point is that if you switch to Linux entirely, you have to do a lot more than just deal with the day-to-day programming--which may or may not have changed--since Linux as an OS uses a different approach than Windows. And Linux is an entirely different beast.
    Which is my point. If you switch, you had better be prepared for it. Therefore, it seems folly to me to suggest dumping Windows in favor of Linux for some free software.
    Now, putting Linux in a virtual box and just using it for some programming tools and using Windows for everything else may just be a good advice as it will cut off the rest of the Linux experience.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. erors from Valgrind ,,
    By prakash0104 in forum C Programming
    Replies: 2
    Last Post: 04-05-2009, 07:33 PM
  2. Bug hunting with Valgrind
    By Smjert in forum C Programming
    Replies: 8
    Last Post: 11-06-2008, 03:21 AM
  3. Replies: 1
    Last Post: 12-01-2007, 01:06 AM
  4. Is valgrind always right?
    By g4j31a5 in forum Linux Programming
    Replies: 3
    Last Post: 07-16-2007, 10:39 PM
  5. Valgrind output
    By m_larkin2001 in forum C++ Programming
    Replies: 1
    Last Post: 06-09-2006, 02:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21