Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Oct 20, 2017 3:51 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sat Jun 01, 2013 10:19 pm 
Offline

Joined: Sun Jul 16, 2006 11:40 am
Posts: 5
Location: Peoria Illinois
I have exactly this issue ... and posted a question in this forum a few days ago with the title

"Memory used for graphics - Carbon vs Cocoa"

Memory will free up when the loop is done ... but before that happens if I'm processing alot of picture files (or large picture files) it crashes with an out of memory error before it finishes.

All ok in carbon, not so in cocoa.

I can avoid the problem by opening the file in the paint event rather than opening the file and setting the picture to each canvas backdrop ... but if I have alot of indexed canvases (for thumbnails) it slows down scrolling alot by firing the paint event on a boatload of canvases on every scroll move or window resize.

I sure hope this gets fixed with next week's release ... and glad to know I'm not the only person experiencing it.


Top
 Profile  
Reply with quote  
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sat Jun 01, 2013 10:30 pm 
Offline

Joined: Tue Aug 07, 2012 9:46 pm
Posts: 26
In my case I am watermarking images and you can just watch the memory leak. I can nil out the picture, but it still leaks until the method is done.


Top
 Profile  
Reply with quote  
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sun Jun 02, 2013 1:45 pm 
Offline
User avatar

Joined: Thu Jul 27, 2006 6:31 pm
Posts: 1698
Location: Monterey, CA
MikeD wrote:
Memory will free up when the loop is done


What happens if you move the looping outside the method, then call the method from a thread, or better yet use a timer?

With a timer:
* Use an outside variable to keep track of your position in the list.
* The timer calls the method
* When the method is complete it increments the variable, then sets up the timer to call it again: timer.period=1, timer.mode=1

_________________
ImagePlay Effects Library (40+ image effects in one open source module. No plugins, no dependencies, no restrictions.)
http://imageplay.sourceforge.net/


Top
 Profile  
Reply with quote  
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sun Jun 02, 2013 2:51 pm 
Offline

Joined: Tue Aug 07, 2012 9:46 pm
Posts: 26
I went the easy route and moved the picture variable from inside the method to outside. That fixed the issue, the memory was released as it should be.

Before it would hit 2 gigs in memory and now didn't go over 200 meg. Thanks for the ideas.

Luke


Top
 Profile  
Reply with quote  
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sun Jun 02, 2013 2:59 pm 
Offline

Joined: Wed Mar 22, 2006 11:15 am
Posts: 712
Location: Southern California
lajdesign wrote:
I went the easy route and moved the picture variable from inside the method to outside. That fixed the issue, the memory was released as it should be.

Before it would hit 2 gigs in memory and now didn't go over 200 meg. Thanks for the ideas.


So if you use a property in a module (for example) then there's no leak?

_________________
Daniel L. Taylor
Custom Controls for Real Studio WE!
Visit: http://www.webcustomcontrols.com/


Top
 Profile  
Reply with quote  
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sun Jun 02, 2013 3:30 pm 
Offline

Joined: Tue Aug 07, 2012 9:46 pm
Posts: 26
Never mind. I forgot I had swapped to carbon. I will try some of the other things later. I hate tons of extra work around a very clear bug. Still leaks horribly in cocoa.


Top
 Profile  
Reply with quote  
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sun Jun 02, 2013 5:16 pm 
Offline

Joined: Sun Jul 16, 2006 11:40 am
Posts: 5
Location: Peoria Illinois
tomis wrote:
MikeD wrote:
Memory will free up when the loop is done


What happens if you move the looping outside the method, then call the method from a thread, or better yet use a timer?

With a timer:
* Use an outside variable to keep track of your position in the list.
* The timer calls the method
* When the method is complete it increments the variable, then sets up the timer to call it again: timer.period=1, timer.mode=1


Well I'll be darned. Some success here. The main purpose of the method is the loop ...but I simply moved the "picture.open" to a thread that's fired off by the method. In the thread all I do is open the picture from a file and save it to a temporary property of the main window, then the method continues by picking up the picture from the property and goes ahead with the rest of the code. A little messy, but it seems to work.

Still ... I hope things speed up with cocoa. In carbon I can open a folder of 800 small jpegs (average 200kb each) and make and display thumbnails ... all in 20 seconds or less. In cocoa it takes about a minute.


Top
 Profile  
Reply with quote  
 Post subject: Re: How do I clear the memory leak when loading pic in Loop
PostPosted: Sun Jun 02, 2013 9:53 pm 
Offline

Joined: Tue Aug 07, 2012 9:46 pm
Posts: 26
Seems to work here also. Not as fast, but doesn't leak. I wish cocoa would be faster, but I just want it to work for the app store.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group