[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
memory usage
From: Junior ####@####.#### Date: 21 Nov 2006 19:44:10 +0000 Message-Id: <B796CCCBCFC.00000517ejr@inbox.com> Hi All, I've been trying to track down a memory usage problem with my app and have a question. I have a page (several pages as a matter of fact), that are redrawn several times or sometimes atleast every three minutes. Does the server destroys the GC contexts created once a function closes? would it be a problem to explicitly destroy these just to be sure the memory is freed? When I unmap a window, does it relinguishes any memory? Thanks. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] memory usage
From: "Greg Haerr" ####@####.#### Date: 23 Nov 2006 08:21:00 +0000 Message-Id: <17a501c70ea3$9df0a380$6401a8c0@winXP> > Does the server destroys the GC contexts created once a function closes? GC contexts are created using GrNewGC(), and are not destroyed until the GrDestroyGC call is executed. This allows context state information to be quickly available in the server for all draw functions, which require a drawable (window or pixmap) and GC. > would it be a problem to explicitly destroy these just to be sure the memory is freed? When you're done using a GC for good, you'll definitely want to destroy them, especially if the code loop calls GrNewGC again. > When I unmap a window, does it relinguishes any memory? No. Unmapping a window just causes the server to send expose events to all windows underneath the unmapped window. The window structure stays around, unchanged following map and unmap calls. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] memory usage
From: Junior ####@####.#### Date: 28 Nov 2006 21:55:23 +0000 Message-Id: <10BF473863A.00000761ejr@inbox.com> >> When I unmap a window, does it relinguishes any memory? > > No. Unmapping a window just causes the server to send expose > events to all windows underneath the unmapped window. The > window structure stays around, unchanged following map and > unmap calls. I believe I have tracked the source that might be related to your comment above. I have several instances of GrDrawImageFromFile() and GrDrawImageToFit(). In the case of tha latter, I have an array of images that is initialized at startup and that function simply pulls the correct image as needed. It looks like if I select an image from this array and map the window, then later timeout and remap the same image (this may happen several times), that seems to be where the memory usage problem is. Since, this image_id (for GrDrawImageToFit()) is fixed in the array, and simply reloaded, I'm not sure why it would use additional memory. Do I need to FreeImage first? If so, I'll have to reinit the array which shouldn't be necessary. What about GrDrawImageFromFile()? What happens when the window is unmap? What am I missing? Thanks, --Jr. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] memory usage
From: "Greg Haerr" ####@####.#### Date: 28 Nov 2006 22:28:37 +0000 Message-Id: <1e1001c7133c$86f24ba0$0300a8c0@RDP> > I have several instances of GrDrawImageFromFile() and GrDrawImageToFit(). In the case of tha latter, I have an array of images that is initialized at startup and that function simply pulls the correct image as needed. > It looks like if I select an image from this array and map the window, then later timeout and remap the same image (this may happen several times), that seems to be where the memory usage problem is. Since, this image_id (for GrDrawImageToFit()) is fixed in the array, and simply reloaded, I'm not sure why it would use additional memory. Do I need to FreeImage first? If so, I'll have to reinit the array which shouldn't be necessary. What about GrDrawImageFromFile()? What happens when the window is unmap? GrDrawImage* functions have nothing to do with window map/unmap. The draw image functions use an internal id to reference a server-stored data structure that has the bits used to draw the image. The application program then uses these bits as the source to draw on a window. GrFreeImage should be called when you will no longer be referencing the image you're requested the server to store. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] memory usage
From: Junior ####@####.#### Date: 28 Nov 2006 22:41:37 +0000 Message-Id: <11269CF426A.000007F9ejr@inbox.com> >> It looks like if I select an image from this array and map the window, > then later timeout and remap the same image (this may happen several > times), > that seems to be where the memory usage problem is. Since, this image_id > (for GrDrawImageToFit()) is fixed in the array, and simply reloaded, I'm > not > sure why it would use additional memory. > Do I need to FreeImage first? If so, I'll have to reinit the array which > shouldn't be necessary. What about GrDrawImageFromFile()? What happens > when > the window is unmap? > > GrDrawImage* functions have nothing to do with window map/unmap. > The draw image functions use an internal id to reference a server-stored > data structure that has the bits used to draw the image. The application > program then uses these bits as the source to draw on a window. > > GrFreeImage should be called when you will no longer be referencing > the image you're requested the server to store. I went ahead and use FreeImage regardless (that is, as long as it's not used), and so far that seems to be working. I'll have to revisit my approach in light of this. Much Thanks, --Jr. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |