Memory Allocation in a Multi-Threaded Environment



Hi - not sure if this is the best forum for this question?

I'm using vc++ 2005 and I've just started playing around with
multithreading.
I quickly realised that multi-threading opens up a whole new slew of bugs
for the novice, but there is one area that is really confusing me.
I have a small class that uses an std::vector array. I create a new worker
process with afxbeginthread - this process will expand/contract the vector
(and do some other stuff) and then return. The problem is, I seem to get
heap corruption errors when I try to access the memory allocated in the
worker thread after that thread has finised. Is this to be expected or
should I be looking elswhere for the bug?

Any general comments on memory allocation in a multi-threaded environment?

Thanks
Jeff


.



Relevant Pages

  • Re: Memory Allocation in a Multi-Threaded Environment
    ... I have a small class that uses an std::vector array. ... heap corruption errors when I try to access the memory allocated in the ... worker thread after that thread has finised. ... Memory allocation as such isn't usually an issue - the issues are all ...
    (microsoft.public.vc.mfc)
  • Re: Closing modeless dialogs
    ... You have to pass strings on the heap, ... I'm sending a user message from my worker thread to my ... there are bugs in your code it can fail in various ways, but correct code will not fail; ... and the fact that it has "strange effects" almost certainly indicates there are serious ...
    (microsoft.public.vc.mfc)
  • Re: Larry Wall, on Tcl
    ... first place is a programming bug, ... Does GC mask such bugs? ... How am I to trust that the system *is* going to collect it ... memory allocation in C -- my low-level programming is generally ...
    (comp.lang.tcl)
  • Re: Memory Allocation in a Multithreaded MFC Application
    ... Bugenhagen a écrit: ... Is there a limit of memory allocation when doing ... > so inside of worker thread? ... when I try to deallocate in another thread that the wne which has ...
    (microsoft.public.vc.mfc)

Loading