SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Memory corruption caused by spawn-rendezvous

    Has anybody else seen this phenomenon? I am developing scripts which run simultaneously on more than one machine, and have decided on the following format of spawning new threads as the one which most conveniently gets the result I want:

    [ ] list of HMACHINE mhandles = GetConnected()
    [ ] int iCounter
    [-] for iCounter = 1 to ListCount(mhandles)
    [-] spawn
    [ ]SetMachine(mhandles[counter])
    [ ]DoSomething()
    [ ] rendezvous
    [ ]

    This has the useful feature that I can run this piece of code from different testcases, on different machines, on different numbers of machines, etc. Every other way of spawning multiple threads (i.e. the examples shown in the users guide and the language reference) require that you individually code the call to each machine, instead of being able to dynamically execute one piece of code on multiple machines simultaneously, according to a predefined list as in the example above.

    Anyway, the problem I have been having is that after the code above has been executed, I immediately get memory problems, all of them with this error:
    *** Error: Internal error - Pointer is invalid or heap is corrupt

    Has anybody else encountered this problem? Is there anything that can be done about it, or am I using the spawn and rendezvous calls in an unsupported way that is inevitably going to lead to problems?

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Memory corruption caused by spawn-rendezvous

    Sorry, the above example code hasn't got the indentation right, which is pretty important to the point I am making;
    It should be emphasised that the rendezvous statement is indented one line less than the spawn statement, at the same level of indentation as the for statement.

    <code>
    list of HMACHINE mhandles = GetConnected()
    int iCounter
    for iCounter = 1 to ListCount(mhandles)
    spawn
    SetMachine(mhandles[counter])
    DoSomething()
    rendezvous
    </code>

  3. #3
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Memory corruption caused by spawn-rendezvous

    Right, thrid time lucky.

    [This message has been edited by vincebowdren (edited 08-10-2000).]

    [This message has been edited by vincebowdren (edited 08-10-2000).]

  4. #4
    Member
    Join Date
    Dec 1999
    Location
    Columbus, OH
    Posts
    78
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Memory corruption caused by spawn-rendezvous

    I have used this many times in the past with no problem. Here is a section of code i use regularly.

  5. #5
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Memory corruption caused by spawn-rendezvous

    Hmmm. I tried that as well, but that was causing some really weird stuff to happen.
    Maybe there's something in the spawned code that tries to alter a global variable or something; if all the threads are trying to do the same thing at once, I can see how it could cause memory corruption. Will investigate further, thanks.

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:27 PM.

Copyright BetaSoft Inc.