Questions tagged [buffer]

A buffer is an area of memory set aside for temporary storage of data while it is being moved from one place to another. This is typically done to speed up processes with significant latency, such as writing to a disk, printer or other physical device. The output is ready to be sent to the device before the device is ready to accept it, so it is moved to the buffer so that the sending program does not have to continue waiting.

A may be used when moving data between processes within a computer. This is comparable to buffers in telecommunication. Buffers can be implemented in a fixed memory location in hardware—or by using a virtual data buffer in software, pointing at a location in the physical memory. In all cases, the data stored in a data buffer are stored on a physical storage medium. A majority of buffers are implemented in software, which typically use the faster RAM to store temporary data, due to the much faster access time compared with hard disk drives. Buffers are typically used when there is a difference between the rate at which data is received and the rate at which it can be processed, or in the case that these rates are variable, for example in a printer spooler or in online video streaming.


References

7035 questions
16
votes
1 answer

Node.js - Buffer vs Uint8Array

In the documentation 1 of the fs module, we can read (for the writeFile method): const data = new Uint8Array(Buffer.from('Hello Node.js')); In the same documentation 2 it is said: With TypedArray now available, the Buffer class implements the …
erwan
  • 311
  • 1
  • 3
  • 9
16
votes
1 answer

What happens in TCP when the internal buffer fills up

Let's say we have the following TCP socket setup where client sends arbitary data to the server. Treat the following as a pseudocode. def client(): while True: data = source.get_data() …
TukeV
  • 641
  • 2
  • 6
  • 13
16
votes
1 answer

Sending a buffer in multipart/form-data POST request Node | Express | request

I have a buffer that I have taken from users uploaded image, that I then want to send on to another API in a multipart/form-data POST request. I'm having issues however with the request object. I want to send a stream or buffer rather than accessing…
twocents
  • 333
  • 1
  • 2
  • 13
16
votes
5 answers

Vim: Changing Buffer Numbers

I usually like to use buffer numbers to go to buffers quickly. Unfortunately, after many searches, opening some files, etc., the buffer numbers get crazy: Is there anyway to assign buffer numbers manually? Is there anyway to restart buffer…
Rafid
  • 18,991
  • 23
  • 72
  • 108
16
votes
5 answers

What are the rules of automatic stdout buffer flushing in C?

I'm just curious which conditions should be satisfied to flush stdout buffer automatically. First of all I was confused that this pseudo code doesn't print output every iteration: while (1) { printf("Any text"); sleep(1); } But if I add…
Andrii Zymohliad
  • 1,237
  • 1
  • 11
  • 17
16
votes
6 answers

Deallocating Direct Buffer Native Memory in Java for JOGL

I am using direct buffers (java.nio) to store vertex information for JOGL. These buffers are large, and they are replaced several times during the application life. The memory is not deallocated in time and I am running out of memory after a few…
sparrow400
  • 315
  • 1
  • 3
  • 9
16
votes
2 answers

Reading output from child process using python

The Context I am using the subprocess module to start a process from python. I want to be able to access the output (stdout, stderr) as soon as it is written/buffered. The solution must support Windows 7. I require a solution for Unix systems too…
Yani
  • 1,465
  • 2
  • 16
  • 25
16
votes
3 answers

Retrieving buffer/packet/payload sizes for USB serial write transfer in userspace Linux C code

Apologies in advance I won't be able to accept an answer here immediately - just thought I'd like to jot this down, while I have the problem... In brief: I can observe three different buffer sizes, when I initiate a write to an usb-serial port using…
sdaau
  • 36,975
  • 46
  • 198
  • 278
16
votes
3 answers

emacs compile buffer auto close?

I want to auto close the compile buffer when there is no error and no warning,but i want to show it when there is warnings. Anyone can help me? This code from emacswiki only do the first requirement. How to change it? ;; Helper for compilation.…
Iceman
  • 367
  • 1
  • 3
  • 5
16
votes
1 answer

Android Optimal Buffer Size

In java there is an optimal buffer size of 32 Kb which is based solely on the cpu architecture being used. On Android phones does the Dalvik VM dynamically know the proper cache of the cpu to get the largest buffer size independent of the many…
L7ColWinters
  • 1,342
  • 1
  • 14
  • 31
15
votes
2 answers

C standard I/O vs UNIX I/O basics

Here's a very basic question I have. In my professor's lecture slide, there is a example I dont really get. She wrote: printf("u"); write(STDOUT_FILENO, "m", 1); printf("d\n"); ...and she said the out put of this code would be: mud I don't…
Allan Jiang
  • 11,063
  • 27
  • 104
  • 165
15
votes
2 answers

How to convert ArrayBuffer to AudioBuffer?

I am streaming an arrayBuffer to convert to an audioBuffer in order to be able to listen to it. I am receiving a stream via a websocket event retrieveAudioStream(){ this.socket.on('stream', (buffer) => { console.log('buffer', buffer) …
Stretch0
  • 8,362
  • 13
  • 71
  • 133
15
votes
1 answer

What is No-Buffering feature of Node.js

Everywhere, it mentions as Node.js has No Buffering feature. For instance from Tutorials Point: No Buffering − Node.js applications never buffer any data. These applications simply output the data in chunks. But what does it signifies? Node.js has…
Veer Shrivastav
  • 5,434
  • 11
  • 53
  • 83
15
votes
3 answers

How to use std::string with asio::buffer()

I get the following error message when I'm trying to use std::string with boost::asio::buffer: boost/asio/detail/consuming_buffers.hpp: In constructor 'boost::asio::detail::consuming_buffers< boost::asio::mutable_buffer,…
niXman
  • 1,698
  • 3
  • 16
  • 40
15
votes
2 answers

Golang - How to overcome Scan() buffer limit from bufio?

I am using the bufio scanner's .Scan() method to read text file lines. However when I reach a certain size in the file lines, the scanner no longer allows me to read, it just returns an empty line. How should I configure the buffer to take in larger…
Nicky Feller
  • 3,539
  • 9
  • 37
  • 54