# Pmt and dictionary blowing out memory

**URL:** <https://www.ruby-forum.com/t/pmt-and-dictionary-blowing-out-memory/224717>\
**Category:** GNU Radio\
**Created:** [November 23, 2012, 12:34am UTC](https://www.ruby-forum.com/t/pmt-and-dictionary-blowing-out-memory/224717 "2012-11-23T00:34:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [November 23, 2012, 12:34am UTC](https://www.ruby-forum.com/t/pmt-and-dictionary-blowing-out-memory/224717/1 "2012-11-23T00:34:45Z")

</div>

Hi All,

I’m using some blocks that I created using pmt dictionaries. Each of  
these  
blocks can run in an infinite loop, so that it is what I am testing.

I connect 2 blocks and I left them running for 10 minutes, what I found  
is  
that the memory consumption (looking at using -top) is increasing every  
time the work function is called. Does it mean that dictionaries are not  
reused memory when the work function is called?. Because if that is the  
case, it will explain why the memory consumption increases.

Thanks for your help,

Regards,

Jose.

---

<div class="post-metadata">

**Author:** ![Jose\_TSDiaz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/848f3c/32.png) [@Jose\_TSDiaz](https://www.ruby-forum.com/u/Jose_TSDiaz)\
**Post date:** [November 24, 2012, 4:35pm UTC](https://www.ruby-forum.com/t/pmt-and-dictionary-blowing-out-memory/224717/2 "2012-11-24T16:35:24Z")

</div>

On Thu, Nov 22, 2012 at 6:33 PM, Jose T. Diaz  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Thanks for your help,
> 
> Regards,
> 
> Jose.

PMT dictionaries are static structures and cannot be changed (as are  
[mostly] all PMTs). When you add an item to a dictionary, you are  
actually creating a new dictionary PMT object, not changing the  
existing one.

So yes, if you’re not handling things properly, you could be  
continuously increasing memory usage.

Tom

---

<div class="post-metadata">

**Author:** ![Jose\_TSDiaz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/848f3c/32.png) [@Jose\_TSDiaz](https://www.ruby-forum.com/u/Jose_TSDiaz)\
**Post date:** [November 25, 2012, 12:00am UTC](https://www.ruby-forum.com/t/pmt-and-dictionary-blowing-out-memory/224717/3 "2012-11-25T00:00:29Z")

</div>

Hi Tom,

Thanks for your answer, is there any way to control the memory usage for  
those elements?. For example, in stream to blob example it is used \_mgr  
to reuse memory, can I do something similar for dictionaries?

Regards,  
Jose

Sent from my iPhone
