visual c++ - How to detect and estimate heap fragmentation in my C++ program? -


I am developing a VC ++ NT service that is meant for continuous work for several months. It intensely uses the VC ++ runtime pile, clearly the pile fragmentation can occur at some point that it is damaged (it is exiting memory).

Which service can I use to estimate the degree, is it prone to pile fracture?

You have given two answers that talk about preventing problems of hep fragmentation, but not So address your questions directly to them. The only way to estimate the probability of facing problems for fragmentation is to imitate many uses, and to measure the fragmentation you receive.

Since this is an NT service, the months of usage are mostly in the simulation. In many cases, there is a lot of possible likelihood that you can normally request faster than expected to receive them , So you probably can only follow the requests worth several months in a few hours, and possibly even less than (Depending on the rate, you usually expect to receive the request. We do ).

Once you are emulating the worth of work (or even if you are doing this), you have to see how many fragmentation you are achieving. It is not easy, but it is normally possible. You will start by injection of a thread in the service process (Googling on "Thread injection" or some information on that order should be appropriate amount). After that you will have to move a heap, especially for the blocks (especially), but most of the requests are too small to be expected to complete. Assuming that you are using MS VC ++, you walk on the heapwalk with a heap, and through this heap, you will tell that the stack has addresses, sizes and positions (free or experiment) of each block.

One final explanation: To create meaningful results for this, your injection thread should be connected to run-time library in DLL, both in executable and DLL. This means that there will be a heap for the whole process, so your injection thread will move on the pile used by your service. If you link to the standard library statically, the DLL and service will have each heap of itself. DLL will run on its own stack, which will not tell you anything about the pile used by the service process.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -