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
14
votes
3 answers

How to disable Buffer in OpenCV Camera?

I have this situation where I use OpenCV to detect faces in front of the camera and do some ML on those faces. The issue that I have is that once I do all the processing, and go to grab the next frame I get the past, not the present. Meaning, I'll…
David Gatti
  • 3,576
  • 3
  • 33
  • 64
14
votes
1 answer

Speeding up the rate that IIS/.NET/LINQ retrieves data from the Network Buffers

When doing a TCP analysis of the traffic between my web servers and database servers I see the network buffers (TCP Window) filling up frequently. The web servers then send TCP messages to the database server telling it that its buffers are full an…
Kyle Brandt
  • 26,938
  • 37
  • 124
  • 165
14
votes
4 answers

How do I read in a large flat file

I have a flat file that has 339276 line of text in it for a size of 62.1 MB. I am attempting to read in all the lines, parse them based on some conditions I have and then insert them into a database. I originally attempted to use a bufio.Scan()…
rvrtex
  • 199
  • 1
  • 1
  • 12
14
votes
2 answers

Slicing a file in Python

I have been recently working on a scripts that takes file, chunks it and analyze each piece. Because the chunking positions depend on the content, I need to read it one byte at a time. I do not need random access, just reading it linearly from…
Hernan
  • 5,811
  • 10
  • 51
  • 86
14
votes
2 answers

Communication between C++ and Python

I am looking for an efficient and smart way to send data between a C++-program and a Python-script. I have a C++ program which calculates some coordinates in-real-time 30Hz. And I wanna access these coordinates with a Python-script. My first idea…
erling
  • 411
  • 2
  • 5
  • 14
14
votes
9 answers

Buffer growth strategy

I have a generic growing buffer indended to accumulate "random" string pieces and then fetch the result. Code to handle that buffer is written in plain C. Pseudocode API: void write(buffer_t * buf, const unsigned char * bytes, size_t len);/* appends…
Alexander Gladysh
  • 39,865
  • 32
  • 103
  • 160
14
votes
1 answer

How many nginx buffers is too many?

Reading the nginx documentation, the proxy_buffer command has this explanatory message: This directive sets the number and the size of buffers, into which will be read the answer, obtained from the proxied server. By default, the size of one…
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
14
votes
1 answer

Write hex in GDB

I'm in a software security class and we are currently learning about buffer overflows and how they are exploited. I have a program that I know how to exploit, but I appear to be unable to do so because I have to write hex that it is not allowing me…
Chris
  • 1,569
  • 2
  • 11
  • 18
14
votes
6 answers

Why Getting Http Request and Response too late

I am using http post method to send request to a Http Server URL. Time difference between request and response is around 60 seconds but as per Server team they are sending response withing 7 seconds once request reached at their end. I don't think…
funsukvangdu
  • 1,621
  • 4
  • 20
  • 33
14
votes
4 answers

Get the number of bytes available in socket by 'recv' with 'MSG_PEEK' in C++

C++ has the following function to receive bytes from socket, it can check for number of bytes available with the MSG_PEEK flag. With MSG_PEEK, the returned value of 'recv' is the number of bytes available in socket: #include ssize_t…
jondinham
  • 8,271
  • 17
  • 80
  • 137
13
votes
2 answers

Reload .emacs for all active buffers

A question already has been asked how to reload a .emacs file after changing it. The proposed solutions were to use M-x load-file or M-x eval-region RET on the changed region. Neither of these solutions affect other open buffers for me. Is there a…
Alan Turing
  • 12,223
  • 16
  • 74
  • 116
13
votes
1 answer

What does a correct call to CGImageCreate look like if the data provider for it uses an array created by the app?

I'm trying to create a bitmap in memory as part of a pattern function that a drawLayer:inContext: method (this method is part of the CALayer delegate protocol) will call. The pattern function looks similar to this: static const size_t…
Jim
  • 1,014
  • 1
  • 11
  • 22
13
votes
1 answer

Detecting file type from buffer in node js?

I have created a buffer from a file which can be pdf, jpg or any other format. Now I want to detect if the buffer is of the pdf file or any other file. request({ url, encoding: null }, (err, resp, buffer) => { hashFromFilebuffer('sha256',…
TechChain
  • 8,404
  • 29
  • 103
  • 228
13
votes
3 answers

HTML5 Video - File Loading Complete Event?

I need to detect when a video file has completed loading. I'm thinking I should use progress->buffer, but in the back of my mind, I remember reading that this was unreliable. Is there a better way, or is this safe? Note, I will be keeping a…
Matrym
  • 16,643
  • 33
  • 95
  • 140
13
votes
7 answers

Ways to buffer REST response

There's a REST endpoint, which serves large (tens of gigabytes) chunks of data to my application. Application processes the data in it's own pace, and as incoming data volumes grow, I'm starting to hit REST endpoint timeout. Meaning, processing…
miracle_the_V
  • 1,006
  • 1
  • 14
  • 31