post() memory leak?

Jan 9, 2008 at 2:29pm

post() memory leak?

While checking an external for memory leaks on Windows, I found that posting
to the max window seems to allocate memory which is never freed. So I
checked this using a standard “print” object, and it behaves the same. Maybe
this is intended behavior, or maybe I’m just missing something, but I
thought I’d mention it anyway. Just in case.

Thijs

#P window setfont “Sans Serif” 9.;
#P number 164 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P message 164 89 164 9109513 sad fglkjg werlwerkj asdfsdf $1 $1 $1;
#P newex 164 110 26 9109513 print;
#P window linecount 4;
#P comment 209 29 100 9109513 drag the value while watching the max
allocated memory in the taskmanager;
#P connect 2 0 1 0;
#P connect 3 0 2 0;
#P window clipboard copycount 4;

#35285
Jan 9, 2008 at 6:47pm

Does the memory get allocated every time you post / print or just the
first time? Does the allocated space continue to grow? If not, then
it’s just a lazy allocation of a shared resource.

_Mark

On Jan 9, 2008, at 6:29 AM, Thijs Koerselman wrote:

> While checking an external for memory leaks on Windows, I found that
> posting to the max window seems to allocate memory which is never
> freed. So I checked this using a standard “print” object, and it
> behaves the same. Maybe this is intended behavior, or maybe I’m just
> missing something, but I thought I’d mention it anyway. Just in case.
>
> Thijs
>
>
> #P window setfont “Sans Serif” 9.;
> #P number 164 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P message 164 89 164 9109513 sad fglkjg werlwerkj asdfsdf $1 $1
> $1;
> #P newex 164 110 26 9109513 print;
> #P window linecount 4;
> #P comment 209 29 100 9109513 drag the value while watching the max
> allocated memory in the taskmanager;
> #P connect 2 0 1 0;
> #P connect 3 0 2 0;
> #P window clipboard copycount 4;
>

#120130
Jan 9, 2008 at 7:36pm

Hi Mark,

I posted the little example patch to illustrate the issue. It has nothing to
do with my external. I assume print internally uses post() to print to the
max window, because it behaves identical to calling post() from my external.
If you keep dragging the value up and down the allocated memory keeps
increasing. Around 10kb per second.

I just double checked on my intel mac and it behaves similar, looking at the
activity monitor. I guess its not a bug then, but I don’t understand why
this happens.

Thijs

On Jan 9, 2008 6:47 PM, Mark Pauley wrote:

> Does the memory get allocated every time you post / print or just the
> first time? Does the allocated space continue to grow? If not, then
> it’s just a lazy allocation of a shared resource.
>
> _Mark
>
> On Jan 9, 2008, at 6:29 AM, Thijs Koerselman wrote:
>
> > While checking an external for memory leaks on Windows, I found that
> > posting to the max window seems to allocate memory which is never
> > freed. So I checked this using a standard “print” object, and it
> > behaves the same. Maybe this is intended behavior, or maybe I’m just
> > missing something, but I thought I’d mention it anyway. Just in case.
> >
> > Thijs
> >
> >
> > #P window setfont “Sans Serif” 9.;
> > #P number 164 70 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
> > #P window linecount 1;
> > #P message 164 89 164 9109513 sad fglkjg werlwerkj asdfsdf $1 $1
> > $1;
> > #P newex 164 110 26 9109513 print;
> > #P window linecount 4;
> > #P comment 209 29 100 9109513 drag the value while watching the max
> > allocated memory in the taskmanager;
> > #P connect 2 0 1 0;
> > #P connect 3 0 2 0;
> > #P window clipboard copycount 4;
> >
>
>

http://www.nano-soundworks.com

#120131
Jan 9, 2008 at 8:38pm

On Jan 9, 2008, at 11:36 AM, Thijs Koerselman wrote:

> I assume print internally uses post() to print to the max window,
> because it behaves identical to calling post() from my external. If
> you keep dragging the value up and down the allocated memory keeps
> increasing. Around 10kb per second.

Hi Thijs,

Keep in mind that the max window maintains a history of something
like the last 20,000 lines. So if you use this example patcher, you
should see that the memory will increase by a few MB, and then
stabilize. Let us know if you don’t see that behavior in your tests.

-Joshua

#P toggle 58 50 15 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 58 75 69 196617 qmetro 1000;
#P button 58 102 15 0;
#N counter 1000000;
#X flags 0 0;
#P newobj 58 161 89 196617 counter 1000000;
#P newex 58 131 62 196617 uzi 200000;
#P newex 58 192 305 196617 print “we are trying to demonstrate max
window memory usage”;
#P connect 2 0 0 0;
#P connect 4 0 3 0;
#P connect 5 0 4 0;
#P connect 3 0 1 0;
#P connect 1 0 2 0;
#P window clipboard copycount 6;

#120132
Jan 9, 2008 at 9:24pm

On Jan 9, 2008 8:38 PM, Joshua Kit Clayton wrote:

>
> Keep in mind that the max window maintains a history of something
> like the last 20,000 lines. So if you use this example patcher, you
> should see that the memory will increase by a few MB, and then
> stabilize. Let us know if you don’t see that behavior in your tests.
>

That makes absolute perfect sense. Thanks for clearing this up! Next time
I’m looking for memory leaks I’ll make sure I disable all window posts.

Cheers,
Thijs

#120133

You must be logged in to reply to this topic.