>>> I want to modify MemCheck to add one more feature to meet my own need. Yet 
>>> I can't find enough technical documents to support that. ...

>> What is your desired feature?  You did not say, yet you complain of
>> "[not] enough technical documents"?  It is to laugh.

> I want to mark every heap memory chunk allocated by the program and then 
> along with those marks to track the specific memory chunk, including count 
> their reference times and store the pointer that may refer to them and so on.

Because you also did not say which existing documentation you had
already consulted, then start with:
   http://valgrind.org/
   http://valgrind.org/docs/manual/index.html
   http://valgrind.org/docs/manual/tech-docs.html
   http://valgrind.org/docs/manual/design-impl.html

Because you intend to annotate each allocated block, then consider
what already is associated with each allocated block: two Red Zones,
the traceback at time of allocation, the traceback at time of free(),
etc.  Take [or add] some space in one of these areas; use it to store
a pointer to a block which contains your new data.

Remember that there can be many pointers to an allocated block.
Remember that storage for actual pointers can be split into
separate pieces for "stem" (base address) and "leaf" (offset from stem).
Consider the machinery that exists to support "memory allocation pools".

-- 

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to