What Is a Data Buffer?
The data buffer is an object used by the user front end to store and manipulate data. In each DataWindow object, there are 4 two-dimensional tables as data buffers, which are used to store the query data.
- First in several characters as one
- There are two types of buffering, full buffering and line buffering. For a full buffer, when the buffer is full, the buffer is emptied. The contents of the buffer are also sent to the destination. This type of buffering usually appears in file input. The size of the buffer depends on the system. However, buffer sizes of 512 and 4096 bytes are more common. For line buffers, when a newline character is encountered, the contents of the buffer are cleared. Keyboard input is standard line buffering. So press Enter and the buffer will be cleared.
- Conceptually, the data buffer is created by two operations under the traditional scheme: the creation of the data buffer entity and the allocation of actual memory. In reality, however, you don't need to allocate actual memory until actual data becomes available-you can separate the two operations.
- An empty linked list of memory blocks can be used initially to create an abstract buffer. The abstract data buffer allocates memory only when actual data becomes available. Freeing memory also becomes the responsibility of the abstract data buffer. With all this in mind, centralized memory management and data copy operations provide the following advantages:
- All parties can construct and / or destroy data buffers by calling predefined API functions. Memory usage will remain close to optimal because buffer memory is allocated only when necessary and will be released as soon as possible to minimize memory leaks. Neither party needs to know the underlying memory management scheme, making the software highly portable, while ensuring compatibility between the two parties interacting. Since no party needs to manage memory, determining the size of the buffer becomes unnecessary (and therefore it is not possible to have the multiple execution problems noted earlier). It turns out that buffer overflows are also unlikely to happen, because data is only copied when there is additional data space.