Wednesday, December 1, 2010

Pointer Ownership

If a library allocates memory for information returned to a client, the library should also deallocate that memory.

The library may have different compile and link options, and may be using a different heap. This problem happens a lot with Microsoft C++ when one component uses multithreadded DLL options and the other component uses singlethreaded options. The problem shows up during runtime. If everyone uses the same allocator, this is not a problem.

No comments:

Post a Comment