CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2003
    Location
    Korea
    Posts
    60

    Unhappy VC IDE and realtime enviroment?

    Hi everyone,

    I have very difficult trouble. My program is realtime, multithreaded ( VS 6.0, VC++, Win2000 Professional-Korean version). If I run program in IDE (run with VC++ Compiler), the program has no error. But If I build in Release Mode or Debug Mode, then run in real environment, program get crashes after about 1 to 2 days. Now I don't know how to fix it now. Thanks for any ideas. Do you know what is big diffirence(s) between IDE and real environment?

    The error is in Korean, equivalent in English is:
    Command at "0xXXXXXXXX" referenced memory at "0xXXXXXXX". The memory could not be read.

    0xXXXXXXXX is differ from time to time, and command address is different from memory address.

    I debugged by the way of this article throuh MAP file. But the 0xXXXXXXXX of command is out of MAP file range (for example command address is 0x24063fba" while maximum address in MAP file is 0x0044a1d6.

    Some friend advised me to change the Design of Multithreads.

    Thanks all.
    Last edited by quangnt; April 5th, 2004 at 02:12 PM.
    Quang

  2. #2
    Join Date
    Apr 2002
    Location
    PA, USA
    Posts
    1,658
    I would start with the basics and work up. Run a session of BoundsChecker (or something similar) and see if you're getting memory leaks or inappropriate memory access.

    The realtime environment I bet cleans up memory quicker and is more picky about what goes on. What I mean is this: in Windows, when you deallocate memory it simply flags the memory as re-assignable so other items can go and assign it. If the memory is untouched and not reallocated to someone else, technically you could still read the data at that location (this caused a huge, long, and very slow debugging process for me once because of recursive deallocation).

    I don't know what else to suggest. Real time systems are a whole other arena and without more information I don't know how much help I or anyone else can be. Good luck!
    =--=--=--=--=--=--=--=--=--=--=--=--=--=
    Please rate this post to show your appreciation for those that helped you.

    Before You Post A Question, Please Read This: How & When To Ask Your Question
    =--=--=--=--=--=--=--=--=--=--=--=--=--=

    -eli
    http://www.toad-software.com
    http://www.dailymission.com - Do It Daily

  3. #3
    Join Date
    Jul 2003
    Location
    Korea
    Posts
    60
    Thank Eli Gassert for quick reply.

    I used Boundschecker to check memory leak. There is no memory leak, but there are many Interface Leak (with Interface Leak Count = 2), because I use MSChart ActiveX in my program. My program also uses 4 CWGraph ActiveX to draw realtime data. Two of them have about 100K points, refresh time is 1500ms. Two others have about 2.5 K points, refresh time is 300ms.

    I known that we can access to unallocated or deallocated memory region except that the region is out process memory. I guess my bug is not resulted from such reason because I used some methods to detect crash position:
    - MAP file.
    - Create my own log file that write information when a function is called and returns.

    I guess that there is a memory overwrite. When memory is overwritten, no thing is weird. Then, may be in Message Procedure, the overwritten region is accessed, and the program crashes. It is why my Crashed Command address is out of MAP file' address range. I've checked, read my source code many times to find such this kind. But I have not found any bug at all.
    Last edited by quangnt; April 5th, 2004 at 02:35 PM.
    Quang

  4. #4
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    You need to look at the stack to determine where in your program the crash is occuring. Mick will tell you about doing that but you can probably use one of the Debugging Tools. Specifically, I think you can get a minidump of the crash and then analyze that.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  5. #5
    Join Date
    Jul 2003
    Location
    Korea
    Posts
    60
    Thanks Sam Hobbs,

    Sorry, I could not access your link. By the way, some days ago I read this article of Hans Dietrich talking about Debug tools. This is a good way to debug program (dumping stack memory). Because my program was running at that time, so I did not insert Debug tool classes into my project. Now I am doing this. I'll inform all of you whenever I have results. If you have any other ideals, please let share with me. Thank you very much.
    Last edited by quangnt; April 5th, 2004 at 03:23 PM.
    Quang

  6. #6
    Join Date
    May 1999
    Location
    Southern California
    Posts
    12,266
    Originally posted by quangnt
    Sorry, I could not access your link.
    It works for me.
    "Signature":
    My web site is Simple Samples.
    C# Corner Editor

  7. #7
    Join Date
    Jul 2003
    Location
    Korea
    Posts
    60
    Now my problems are now removed.

    After long debugging, I concluded that the National ActiveX is the reasons. I wrote my own component replacing these ActiveXes. Now program runs smoothly.

    Thanks for all.
    Quang

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured