From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

NiFPGA 7842 DMA FIFO release memory after read

Solved!
Go to solution

Hi, 

 

I am using the Ni7842 RIO board. I have implemented a data acquisition block on my FPGA (target device) and filling up a FIFO to transfer data from target to host machine.I have set up the FIFO to a size of 10k. The number of samples  that I am trying to acquire is 16K on three channels simultaneously. 

 

I am reading data from the DMA FIFO implemented on a host machine through the C API support provided for the board. I setup the FIFO for read in three steps by making calls to methods:

-ConfigureFIFO  - to configure FIFO depth

-Read FIFO - to read elements into host DMA - This is executed in a loop reading chunks of 1k datapoints at every iteration (the datatype is I16 so it is 2kb that is being read)

-Stop FIFO 

 

Does the memory allocated on the host DMA through configureFIFO method call need to be released explicitly by calling ReleaseFIFO? Note that AcquireFIFO is not being called here. 

 

Please advice. 

 

Thanks!

0 Kudos
Message 1 of 5
(5,439 Views)

NiFpga_ReleaseFifoElements only applies to previously acquired FIFO elements. Therefore, if no elements are Acquired there should be no reason to call Release.

Jeff L
National Instruments
0 Kudos
Message 2 of 5
(5,416 Views)

I appreciate you quick reply Jeff!

 

We monitored the host system for any potential memory leak and saw a jump of approximately 96KB in primary memory usage when we run this application which acquires 32KB * 3 channels through FPGA. Ofcourse there are other processes running parallelly that might be contributing to this. But I was curious as to what happens when I call configureFIFO to allocate DMA FIFO depth on the host. Do you release this memory if allocated on stopping FIFO?

 

Thanks,

PG

 

0 Kudos
Message 3 of 5
(5,408 Views)
Solution
Accepted by topic author pgargesa

I believe all the memory is de-allocated upon calling NiFpga_Finalize but I have not been able to find specific documentation to confirm that.

 

There is a FIFO specific example included with the FPGA C API that my be of interest to you if you have not already looked at it.

Jeff L
National Instruments
0 Kudos
Message 4 of 5
(5,395 Views)

Thanks Jeff!

I made sure we are calling the Finalize method to unload the library and looks like we are. Just a request, could you please consider documenting the memory allocation and de-allocation of the DMA FIFO during read/write FIFO operations and/or including examples for the same the next time a new version of the C API is released? I am sure a lot of users would appreciate that.

 

Thanks for the prompt responses again!

 

Regards,

PG

0 Kudos
Message 5 of 5
(5,390 Views)