[Gambas-user] debugging a (apparent) memory leak

Kevin Fishburne kevinfishburne at ...1887...
Tue Oct 29 04:48:10 CET 2013


On 10/28/2013 10:36 PM, Benoît Minisini wrote:
> Le 29/10/2013 03:27, Benoît Minisini a écrit :
>> Le 29/10/2013 02:20, Kevin Fishburne a écrit :
>>> I don't think it's always been like this, but when I sometimes forget to
>>> close the server app running on my physical server and it runs for a few
>>> days I notice gb3 is using all 8 GB of system RAM and several GB of the
>>> swap partition. There's nothing in the app (that I know of) that should
>>> ever be using that much memory, so it sounds like a memory leak.
>>>
>>> Is there a way, other than manually following the logic of the entire
>>> execution sequence, to identify what part of the code is continually
>>> sucking up more and more RAM?
>>>
>>> Also, other than the infamous GOSUB without a corresponding RETURN, what
>>> types of declarations or code logic should I look for if I do scan
>>> through the codebase? Red flags, in other words.
>>>
>> If you have a main loop somewhere, you can count the number of object
>> allocations at each loop, by using the Class.Count property:
>>
>> Dim hClass As Class
>> For Each hClass In Classes
>>      Print hClass.Name;;hClass.Count
>> Next
>>
>> Then you can see which kind of object allocation grows indefinitely.
>>
> Another possibility would be an array whose size grows indefinitely too,
> but the last method won't allow you to detect it.
>

I'm past my beer limit for programming (about 20 minutes ago), but thank 
you. That's exactly the sort of thing I was looking for. Will give it a 
try tomorrow to see what I find and will report back.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list