[vwnc] Cairo Memory Management

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Cairo Memory Management

Joseph Whitesell
After painting with Cairo eventually memory starts getting loaded up and
finally a BadStatus alert is thrown. Some of the Cairo methods seem like
they might handle this but I am not sure how to use them. Any pointers or
hints would be appreciated. (By the way the code I am using usually pushes
and then pops and paints.)

TIA
--
Joe Whitesell

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Cairo Memory Management

Boris Popov, DeepCove Labs (SNN)
I know this may sound like a silly question, but are you using various
*while: APIs to do your allocation/deallocation?

#newCairoSurfaceWhile: vs #cairoSurface
#newCairoContextWhile: vs #context

-Boris

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Joseph Whitesell
Sent: Friday, June 19, 2009 11:28 AM
To: [hidden email]
Subject: [vwnc] Cairo Memory Management

After painting with Cairo eventually memory starts getting loaded up and
finally a BadStatus alert is thrown. Some of the Cairo methods seem like
they might handle this but I am not sure how to use them. Any pointers
or
hints would be appreciated. (By the way the code I am using usually
pushes
and then pops and paints.)

TIA
--
Joe Whitesell

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Cairo Memory Management

Joseph Whitesell
Thanks. Yes I am using code similar to:

aContext newCairoContextWhile: [:aCr | self drawOn: aCr]

Joe

-----Original Message-----
From: Boris Popov [mailto:[hidden email]]
Sent: Friday, June 19, 2009 4:43 PM
To: [hidden email]; [hidden email]
Subject: RE: [vwnc] Cairo Memory Management

I know this may sound like a silly question, but are you using various
*while: APIs to do your allocation/deallocation?

#newCairoSurfaceWhile: vs #cairoSurface
#newCairoContextWhile: vs #context

-Boris

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On
Behalf Of Joseph Whitesell
Sent: Friday, June 19, 2009 11:28 AM
To: [hidden email]
Subject: [vwnc] Cairo Memory Management

After painting with Cairo eventually memory starts getting loaded up and
finally a BadStatus alert is thrown. Some of the Cairo methods seem like
they might handle this but I am not sure how to use them. Any pointers
or
hints would be appreciated. (By the way the code I am using usually
pushes
and then pops and paints.)

TIA
--
Joe Whitesell

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Cairo Memory Management

Travis Griggs-3

On Jun 19, 2009, at 2:39 PM, Joseph Whitesell wrote:

> Thanks. Yes I am using code similar to:
>
> aContext newCairoContextWhile: [:aCr | self drawOn: aCr]

Hi Joseph,

Any idea whether it's a problem with Smalltalk maintaining handles? Or  
Cario structures not being cleaned out of the heap?

What does this expression show when things are getting bad:

| count |
count := 0.
ManagedHandle allSubclassesDo: [:each | count := count + each  
knownHandles size].
count

This is on Windows? Would it be possible/hard to run the same thing on  
Linux or OSX and see if the issue is there as well? Are you using  
Pango as well?

--
Travis Griggs
Objologist
For every adage, there is an equal and contrary un-adage

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Cairo Memory Management

Joseph Whitesell
Yes it is windows and yes I am using Pango.

I ran the code you suggested and found that the

Pango.Layout KnownHandles

dictionary is holding onto thousands of key>value pairs like:

22762264->(nil)

It grows each time e.g. I resize the window containing the cairo stuff.

The sort of code I am using to create Pango texts is similar to this:

| textSurface |
        textSurface := CairoGraphics.CairoGraphics.ImageSurface
                format: CairoGraphics.CairoFormat argb32
                extent: 1 @ 1.
        ^(textSurface context newLayout)
                text: aString withCRs;
                fontDescriptionString: self font


This is all being done within a newCairoContextWhile: block but perhaps I
need to do something else to zap the handle growth?

Thanks,

Joe

P.S We can test this on Linux early next week if it will be helpful.


-----Original Message-----
From: Travis Griggs [mailto:[hidden email]]
Sent: Friday, June 19, 2009 5:48 PM
To: [hidden email]
Cc: 'Boris Popov'; [hidden email]
Subject: Re: [vwnc] Cairo Memory Management


On Jun 19, 2009, at 2:39 PM, Joseph Whitesell wrote:

> Thanks. Yes I am using code similar to:
>
> aContext newCairoContextWhile: [:aCr | self drawOn: aCr]

Hi Joseph,

Any idea whether it's a problem with Smalltalk maintaining handles? Or  
Cario structures not being cleaned out of the heap?

What does this expression show when things are getting bad:

| count |
count := 0.
ManagedHandle allSubclassesDo: [:each | count := count + each  
knownHandles size].
count

This is on Windows? Would it be possible/hard to run the same thing on  
Linux or OSX and see if the issue is there as well? Are you using  
Pango as well?

--
Travis Griggs
Objologist
For every adage, there is an equal and contrary un-adage

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc