Heap management in a multithreaded windows application
-
Hi everybody! I have a typical problem here. My application is a multithreaded one. In one of the cases, there are multiple threads which will be using a common buffer which is a member variable of a particular class. This buffer is also allocated memory by one of these threads and to be accessed by the other threads. I am getting a dbg_heap error as debug assertion. How do i go about solving this problem. Please help me out as this is very urgent. Thanx in advance. regards, sailesh
-
Hi everybody! I have a typical problem here. My application is a multithreaded one. In one of the cases, there are multiple threads which will be using a common buffer which is a member variable of a particular class. This buffer is also allocated memory by one of these threads and to be accessed by the other threads. I am getting a dbg_heap error as debug assertion. How do i go about solving this problem. Please help me out as this is very urgent. Thanx in advance. regards, sailesh
Use one of the synchronization classes to ensure that only one thread can access the thread at a time (or multiple threads can read; but they must be done before a write could be performed). Look for the .NET
Monitor
andMutex
classes for more info (more are available but those two are off the top of my head). James