User`s guide
6 Acquiring Image Data
6-38
Managing Memory Usage
In this section...
“Memory Usage” on page 6-38
“Monitoring Memory Usage” on page 6-38
“Modifying the Frame Memory Limit” on page 6-39
“Freeing Memory” on page 6-40
Memory Usage
The first time it needs to allocate memory to store an image frame, the toolbox
determines the total amount of memory it has available to store acquired image frames.
By default, the toolbox sets this value, called the frame memory limit, to equal all the
physical memory that is available when the toolbox is first accessed.
Image data can require a lot of memory. For example, even a relatively small (96-by-128)
24-bit color image requires almost 37 K bytes for each frame.
whos
Name Size Bytes Class
rgb_image 96x128x3 36864 uint8 array
Monitoring Memory Usage
The toolbox includes a utility function, called imaqmem, that provides information about
the toolbox's current memory usage.
The imaqmem function returns a structure that contains several memory usage statistics
including the total amount of physical memory available, the amount of physical memory
currently in use, and a value, called the memory load, that characterizes the current
memory usage.
To illustrate, this example calls imaqmem and then uses the frame memory limit and the
current frame memory usage statistics to calculate how much memory is left for image
frame storage.
out = imaqmem;