Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Avoiding memory deallocate

Check out the below LinuxRT code (FPGA code available on request)

RT Variable allocate.png

 

As the size of the requested chunk goes up, memory use also goes up and when we request smaller amounts, the memory use goes back down.

 

Ideally, I'd like to allocate everything ahead of time, and then feel comfortable that as long as my array size doesn't go above their allocated amount, I'll never use up all my memory. Another benefit is that I could observe the total memory use and make sure it doesn't increase. I'd be able to disable code and easily identify the memory leak.

 

Is that possible with the above code?

0 Kudos
Message 1 of 3
(2,283 Views)

The simple solution is to always request the same number of samples every iteration.  Then your memory will not change.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(2,264 Views)

In my case there's a highly variable amount of data coming in at a given time. Sometimes it's almost nothing and waiting for a "full packet" would require that some of that data is stale.

0 Kudos
Message 3 of 3
(2,260 Views)