Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome General
 PowerHome Messageboard : PowerHome General
Subject Topic: Memory Leak and Handle Count Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 17 2008 at 01:00 | IP Logged Quote grif091

I've notice there is a small memory leak and the Handle count has a net increase over time. Running latest Beta.

11:57 PM   671MB    did not note Handle count
12:32 AM   672MB    27665 Handles
12:44 AM   673MB    27677 Handles
3:31 AM    680MB    30510 Handles
4:20 AM    683MB    31300 Handles
4:46 AM    684MB    31431 Handles       

PH is polling on the 10 second default value. No automation. Running SDM 308. A little more than 40 Insteon devices. Had shut down everything except PH during test period.

Edited by grif091 - April 17 2008 at 04:54


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 17 2008 at 07:39 | IP Logged Quote TonyNo

~700M? What's that?

My experience is that PH uses 1/10 of that or less.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: April 17 2008 at 08:56 | IP Logged Quote BeachBum

Lee, Tony is right that is high although I tracked problems like that in the past and found 15 second poll interval did increase it. I’m on ALPHA and running about 6 MB with no polling at this moment. PH has been active for 2 days.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 17 2008 at 10:41 | IP Logged Quote grif091

The actual memory number is not what is important, it is the fact that the number climbs over time as PH runs. Memory is being allocated and not released over time. I closed PH at 5:00 AM, the memory number went down to 659MB and stayed at 659MB until 10:00 AM when I started up the Netscape email client and IE to make this post. Not uncommon for programs to leak memory. Not something that is obvious unless you run some tool, Windows Task Manager in this case, that monitors memory usage. Tools like this, that came out of NT, are valuable in assessing the impact of a program that you expect to run 24/7. If IE leaks memory, so what. The purest will complain and Microsoft will fix it, but who expects IE to be up 24/7. Memory is owned by the process so when the process ends, the memory is released. If I run PH 24/7, as will be needed if I use PH for HA, it cannot leak memory.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: April 17 2008 at 11:30 | IP Logged Quote BeachBum

But the actual number is important if the working set is getting too large or the request for an equivalent of “get main” is too large and then is not released. Typically we see a number under 10MB in the average environment. If the number climbs to 600MB and then when you recycle back and start over and the number goes back to 6MB then I propose there is a problem. I don’t see a problem on my system until I get in the 1.6GB range then I/O response on paging eats up the resources. Microsoft will fix the problem if it is a true memory leak when the operating system does not release all memory associated with the thread. The numbers you posted are the same as I observed with polling active. Setting scan off sometimes brought them down but ultimately it was the bounce of PH that fixed it. I now run scan in the afternoon once per minute and which slows down the memory growing problem. The system I run PH on, that never scans, still grows but at a much slower rate. I don’t know if it is truly a memory leak or a memory management problem. Only Dave can answer that. The other one that grows is SDM3 but if eventually fixes itself when it resets its log. I have other programs that have true memory leaks and I manage them accordingly.

For reference check this thread.

http://www.myx10.com/forum/forum_posts.asp?TID=1096&KW=memor y+usage


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
bhlonewolf
Senior Member
Senior Member


Joined: March 29 2007
Online Status: Offline
Posts: 198
Posted: April 17 2008 at 12:49 | IP Logged Quote bhlonewolf

I'm not an expert on Powerbuilder or the powerbuilder runtime, but just some observations:

1. 600MB usage seems high for Powerhome. I haven't upgraded to the new alpha but I'm around 13MB or so.

2. While the trend is concerning, I'm more concerned about it consuming 670MB+, not so much growing to 680MB+. It's impossible to say it's a memory leak, particularly is the app is managed by a runtime. There are lots of factors that can contribute to increasing memory, particularly for managed applications. Even an app that, for example, keeps log files in memory without ever purging them -- well, that's not a leak in the strictest sense, but it is a design error.

3. Not sure how powerbuilder works, but on most managed runtimes, true memory leaks are actually very difficult/rare, and often the fault of the runtime itself.

Just my 2 cents...


Edited by bhlonewolf - April 17 2008 at 12:49
Back to Top View bhlonewolf's Profile Search for other posts by bhlonewolf
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 17 2008 at 13:07 | IP Logged Quote grif091

I have many things that are auto started when my system comes up that contributes to the 600 MB+ number. Norton, Netscape, even my USR dial modem brings a chunk of stuff up to monitor for an inbound call if on a V91 portal. That is why the base memory number is not the issue. It is what happens to that number over time when running a particular application. That is also why I waited 5 hours after stopping PH to be sure nothing else was consuming memory (and to get a few hours sleep). May be scanning that is leaking. Even more plausible since I have no HA function defined. May not even be a specific memory acquisition that is not being released. Creating Handles and not deleting them causes memory to go up. Creating any resource that acquires memory and then failing to delete/close/terminate, whatever applies to that resource, causes memory usage go up. There is a cycle to memory usage by PH. It goes up, it goes down, typical of any application. The concern is the high water mark climbs over time. I would not consider the SDM3 memory pattern you mentioned a leak. One might worry about the time frame of the cleanup but since the cleanup is happening it is not really a leak.

This is a concern only for applications that run 24/7. Perhaps my expectation that memory leaks are a problem was wrong for a consumer application like PH. I sure was not expecting any push back.

Pete, Just read the thread you referenced. Sure sounds like SDM3 was the problem then. I’ll put on another test tonight, if I can stay awake, and track SDM3 usage as well as PH. Thanks. Have not found the blank area where I should be typing DM, but I consider this a test and will not ask for clarification yet.

I was watching the total memory number under Windows Task Manager as it is easy to watch and it is graphed. I made sure nothing else was running before starting the PH test. Also made sure that during the 5 hours following the PH test the number was no longer climbing after PH was stopped. Had not considered SDM3 as a separate issue as it is part of the PH package. However, I would see no chance of getting it fixed if that is the leak.

EDIT: when assessing whether an application can satisfy a requirement, looking only at the PH process is not helpful. In this case, the growth of memory usage may be out of the control of the application owner, but that is irrelevant in the evaluation of the suitability of an application as a whole. If PH cannot be run 24/7 without an ever expanding memory requirement, that has to be a factor in deciding whether to use PH, regardless of "the cause". Certainly no reflection on PH in the very narrow sense or Dave's capabilities as a programmer or his responsiveness as I could not be more please with both. Unfortunately, if I can't turn it on and leave it on, that is a problem. It is great fun playing with and learning PH for now. However, when my HA activity is done and the house is doing what I want it to, I don't want to have to think about PH or do something with PH every day just to keep things running. Maybe the answer is to move to a PLM, maybe the answer is to use on older level of SDM3 (which presents a problem for me as the version is not compatible with Houselinc), maybe the answer is to move to dedicated hardware for HA and use PH only for maintaining the Insteon network, I really don't know yet what the right answer is for me. The only thing I do know is that one cannot make an informed choice with doing a thorough evaluation. Dave understands that, that is why he offers the free 30 day evaluation period. Although in this case I have already purchased PH and have no regrets in doing so.

Edited by grif091 - April 17 2008 at 14:01


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
TonyNo
Moderator Group
Moderator Group
Avatar

Joined: December 05 2001
Location: United States
Online Status: Offline
Posts: 2889
Posted: April 17 2008 at 14:15 | IP Logged Quote TonyNo

Ah. You must be referring to a total in-use number, not just the PH process.

To be clear, my 1/10 number was wrong. It should have been 1/100.

My experience with the SDM is that it leaks a lot more than other apps. Normal RAM usage is 3-4M, but I have seen it hit 30M and beyond. Bringing up the SDM and minimizing it releases the extra memory.

I run PH 24/7 (Win XP Pro) and usually like to restart the machine every month.
Back to Top View TonyNo's Profile Search for other posts by TonyNo Visit TonyNo's Homepage
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: April 17 2008 at 14:16 | IP Logged Quote BeachBum

To clarify Lee, my PH increments about the same numbers as yours but my base line is 475 and right now I’m sitting at 680 plus 17k handles, 678 thread and 54 processes. This is my norm but I do bounce the system at least every week of 2. I cycle PH more often because of the way I test. I also trim my Event Log to 2 days every day. I was eager to see if bhlonewolf would chime in and he did. Thks for the input. As for the SDM, open the window and scroll all the way to newest entry and in the space after type dm. This allows you to type commands directly to SDM. Type help in the window besides SEND for the list.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
bhlonewolf
Senior Member
Senior Member


Joined: March 29 2007
Online Status: Offline
Posts: 198
Posted: April 17 2008 at 21:40 | IP Logged Quote bhlonewolf

Ah, well, I thought you meant 680MB (or thereabouts) for the PH process, not the whole system!

Measuring that on the whole system (IMHO) has limited value. It's a fine place to start especially to give you an overview of overall system health, but the numbers moving so slightly could be for any number of reasons.

I'd recommend you use something like Process Explorer and dive into the process a bit more and watch it over time.
I've been running SDM and PH on my server for some time (Win2003 Standard) and it seems fine on my system, so either a potential leak is going unnoticed (I typically have it up for 3-4 weeks at a time, depending on what I'm working on), or it's a compatibility issue with another component/software that only manifests in certain scenarios. Or, it's related to a certain condition -- such as polling, number of devices, etc.

Dave's expertise would be needed here, but I would think (completely uneducated guess) that Powerbuilder does all the memory management for the application with perhaps only a few exceptions. I'd suspect the SDM a bit more, but without more data -- really tough to say.
Back to Top View bhlonewolf's Profile Search for other posts by bhlonewolf
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 18 2008 at 08:55 | IP Logged Quote grif091

My thanks to all who have contributed their experiences on the subject. Much appreciated. Ran a 12 hour test last night, using the defaults PH establishes when it comes up. The ph process gained 1M, SDM3 gained 26.5M. Over a 30 day period that would be a 1650M increase in memory allocation. Plan is to run another 12 hour test tonight with polling shut off.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: April 18 2008 at 13:42 | IP Logged Quote BeachBum

I would have to agree with Brian. The only time I saw a memory problem was a couple of releases ago when there was a run away problem when editing macros that was fixed in 12. I’ve been using Process Explorer and Task Manager and I don’t see anything that supports a memory leak. Task Manager shows PH growing but that is only the current working set which typically grows when not much is happening. But when PH is restored and then eventually minimized the numbers drop dramatically. Maybe that in it’s self is a problem. This is also true for SDM. As far as threads I’m showing 9 for PH. The number of handles for PH is holding at 398. PH private virtual memory is holding at 29.3. The virtual size could possible reach 123M if I interpret the information correctly. Both my systems show similar results. The difference being one uses SDM and is on ALPHA and the other is on R12 and doesn’t use SDM.

In the last 12 hour test period using Task Manager delta results are:
PH Mem +17M
Tot Mem +30M
Tot Handles +500
Tot Threads +3
SDM Mem +2M

In the last 12 hour test period using Process Explorer delta results are:
PH Working set Mem goes up and down 6.7 – 15.4
PH Private Virtual Mem same
PH Handles same
PH Threads same

The bottom line is it appears that PH is growing using Task Manager or is something else is influencing the numbers. Like Lee I’ll keep watching and recording.


__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: April 18 2008 at 14:16 | IP Logged Quote dhoward

I also have experienced a memory leak using .12 and the SDM. PowerHome runs 24/7 and can be up for a couple of months or more easily. Using Task Manager, my total memory on a fresh boot (running PH) will be somewhere around 365 meg. In a couple of months, I'll be up around 700 meg. Stopping PH and the SDM will buy back some memory (and time), but it never goes back down to the original 365.

I thought that PH had a memory leak and scrubbed the code top to bottom to try and find something. PowerBuilder, of course, handles all garbage cleanup internally, but some objects can be dynamically allocated so I verified that I was destroying all objects when they went out of scope. Of course, I knew (as most people do) that the SDM definately has a memory leak, but I didnt think that it was entirely the SDM's fault.

However, since loading the alpha and doing away with the SDM entirely, Ive been up for over a month now with no appreciable gain. It will go up 30 - 40 meg, but will be back down the next day. For me, it appears that the SDM was the source of the memory leak...or, since the alpha is in PowerBuilder 10.5, the version change has corrected a leak problem that may have been inherent in version 9.03.

If anyone is testing the alpha with the PLM instead of the PLC (SDM), I'd would like to hear if your numbers are similar to mine.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
bhlonewolf
Senior Member
Senior Member


Joined: March 29 2007
Online Status: Offline
Posts: 198
Posted: April 18 2008 at 14:24 | IP Logged Quote bhlonewolf

grif091 wrote:
My thanks to all who have contributed their experiences on the subject. Much appreciated. Ran a 12 hour test last night, using the defaults PH establishes when it comes up. The ph process gained 1M, SDM3 gained 26.5M. Over a 30 day period that would be a 1650M increase in memory allocation. Plan is to run another 12 hour test tonight with polling shut off.


I mean this constructively & concisely:

The test you ran, the conclusion, and follow up test are flawed. You can't concluded memory accumulation over 30 days. While the test is fine for a start, you need to run it potentially for days, even weeks. While I'm not profiling specifically, I've had it running on my machine for about a week, and I'm hoving at 11MB and 13MB for the SDM and PH, respectively. 30 second polling.

My opinion is that you need to run that over a longer period of time, without making any changes. It could be there's a problem -- but it could also be memory would grow to a set amount, then reclaim, etc. Then change some things and test again.

Hope this doesn't come across as rude, just think it's too early and not enough info to draw any conclusion...



Back to Top View bhlonewolf's Profile Search for other posts by bhlonewolf
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 18 2008 at 20:09 | IP Logged Quote grif091

bhlonewolf, no offense taken. I appreciate input from someone who is trying to help. If 12 hours is not sufficient, how long should I run a test for it to be meaningful?

As an FYI to anyone following along with what I had planned to be my next 12 hour test, running ph without polling, was stopped after a few hours. Neither ph nor SDM3 changed more than noise when ph was not polling.

Next test I did was to bring up Houselinc and see if the SDM3 process would accumulate memory as when "polling" with ph. Houselinc does not have a running "poll" function so I had Houselinc "rediscovery" my devices. That function reads the link database of all the selected devices. No surprise to folks who have already looked into this. The SDM3 process memory grew at a rate that looked higher than when running ph. Not surprising because Houselinc does not pause between devices.

EDIT: I always seem to forget something. I have started another ph test, with polling on. Will run it for as long as you suggest for a meaningful test. If there is a memory cleanup cycle I hope it does not take a week or more for it to happen, I'm going to accumulate a lot of storage usage in that time frame.

Edited by grif091 - April 18 2008 at 20:24


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
BeachBum
Super User
Super User
Avatar

Joined: April 11 2007
Location: United States
Online Status: Offline
Posts: 1880
Posted: April 18 2008 at 20:19 | IP Logged Quote BeachBum

So Lee if you open and shrink SDM does it release memory as Tony and I discovered.

__________________
Pete - X10 Oldie
Back to Top View BeachBum's Profile Search for other posts by BeachBum
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 18 2008 at 20:29 | IP Logged Quote grif091

I did not try that. I'm hoping to find an HA solution that does not require intervention. I will try that at the end of the current test. Thanks for the reminder.

EDIT: I did it again. Thanks for the information on SDM trace. I may never have found that.     

Edited by grif091 - April 18 2008 at 20:33


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
bhlonewolf
Senior Member
Senior Member


Joined: March 29 2007
Online Status: Offline
Posts: 198
Posted: April 18 2008 at 21:30 | IP Logged Quote bhlonewolf

For runtime, I'd suggest running for as long as humanly possible :) To give a real number, I'd suggest a week as a good starting point, with checks along the way.

For example, on my system, I've had it up for 8 days now. (I do some work on it, occasionally rebooting, but for the most part it will stay up 24/7.) SDM v308 is at just over 3MB, and PH (v12) is around 14MB. It's been running the entire 8 days.

That's not to say there isn't a leak, but so far, I haven't been able to manifest based on my OS and application set.   (Or the leak is so small that I'm not bothered by it.) Earlier today, about 8 or so hours ago, I posted the SDM was at 11MB, so it's quite a bit less right now. I'm polling at 30 second intervals. Could be a driver issue, software incompatibility, etc.

So, step 1, if you haven't already, is download Process Explorer from the MSFT web site. Just search for it -- it's a free download. This is like Task Manager but provides MUCH more information.

Then, over a week or so, either manually or programmatically, plot the usage. Process Explorer can do this for you -- just leave it running. When you use Process Explorer, you'll also see rteng7 (database) and sdm3.exe running as nested under pwrhome -- this is also useful to see which processes were spawned.

I'd also leave polling enabled. If you disable it, you may not notice a leak if the problem manifests based on activity.

If you notice a disturbing trend over the week, I might run the test again, halving the poll frequency and doing it again. Or doubling the poll frequency. You get the idea.

Clearly it will take some time :) But it's a solid approach to take.



Back to Top View bhlonewolf's Profile Search for other posts by bhlonewolf
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 19 2008 at 00:10 | IP Logged Quote grif091

bhlonewolf, thanks for the suggestions. I am running sdm3 308, polling on the default 10 second interval, takes 9-10 minutes for ph to run through the device list, no HA. Will be a ton of iterations after a week. Last time I did serious performance analysis I used Intel Vtune. Think I will try that first. It's been some years so I expect a learning curve.

I did not see memory growth for ph or sdm3 processes when Status Scan was turned off. Had started this test before seeing your last note so my starting rteng7 number is a little out of sync with the other two but I don't think that will matter over 7 days. It does not look like the database number is moving anyway.


__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 
grif091
Super User
Super User


Joined: March 26 2008
Location: United States
Online Status: Offline
Posts: 1357
Posted: April 19 2008 at 13:23 | IP Logged Quote grif091

Sorry folks but my PLC has developed a problem. About 18 hours into the last test ph started displaying send errors and the PLC LED is blinking about 2 times a second. Will get back to the testing when PLC is working.

__________________
Lee G
Back to Top View grif091's Profile Search for other posts by grif091
 

Page of 3 Next >>
  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum