Welcome to our website
To take full advantage of all features you need to login or register. Registration is completely free and takes only a few seconds.
C coding tip: Self-manage data buffer memory
Posted by Philipp Esselbach on: 01/07/2004 03:07 PM [ Print | 0 comment(s) ]
The C programming language defines two standard memory management functions: malloc() and free(). C programmers frequently use those functions to allocate buffers at run time to pass data between functions. In many situations, however, you cannot predetermine the actual sizes required for the buffers, which may cause several fundamental problems for constructing complex C programs. This article advocates a self-managing, abstract data buffer. It outlines a pseudo-C implementation of the abstract buffer and details the advantages of adopting this mechanism.