473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

DCOP memory leak?

Hello,

I'm writing a python script for Amarok, I communicate with Amarok
using DCOP.
Now, I have to call DCOP very often and I noticed that every time I
make a DCOP call my program keeps growing in memory size.

To make sure it was DCOP i wrote the small program below:

from dcopext import DCOPClient, DCOPApp

while 0==0:
dcop=DCOPClient()
dcop.attach()
AmarokDcopRes = DCOPApp ("amarok", dcop)
ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs()
print Ms

If you run this script and monitor it's memory use you'll see that it
keeps growing.

Does anyone know how I can solve this problem?

Kind regards,

Tim

Jan 30 '07 #1
5 1394
Now, I have to call DCOP very often and I noticed that every time I
make a DCOP call my program keeps growing in memory size.

To make sure it was DCOP i wrote the small program below:

from dcopext import DCOPClient, DCOPApp

while 0==0:
dcop=DCOPClient()
dcop.attach()
AmarokDcopRes = DCOPApp ("amarok", dcop)
ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs()
print Ms

If you run this script and monitor it's memory use you'll see that it
keeps growing.
It's probably silly, but what's about 'del dcop' as the last line of
your loop ?
Jan 30 '07 #2
Ti*****@gmail.com wrote:
Hello,

I'm writing a python script for Amarok, I communicate with Amarok
using DCOP.
Now, I have to call DCOP very often and I noticed that every time I
make a DCOP call my program keeps growing in memory size.

To make sure it was DCOP i wrote the small program below:

from dcopext import DCOPClient, DCOPApp

while 0==0:
dcop=DCOPClient()
dcop.attach()
AmarokDcopRes = DCOPApp ("amarok", dcop)
ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs()
print Ms

If you run this script and monitor it's memory use you'll see that it
keeps growing.

Does anyone know how I can solve this problem?

Kind regards,

Tim
I think you will find the objects are getting created so fast that
garbage collection doesn't have time to clean them up as fast
as you are creating new ones. Since del dcop is not guaranteed
to be "immediate" that won't help.

Q: Can't you create dcop instance outside the loop and reuse it
for every time through the loop?

Q: Can you sleep or something after each loop or do you really
want to peg the CPU checking forever?

Q: How do you ever get out of this infinite loop?
Note: while 0=0 is better written as while 1: and you need a
break somewhere to get out of the loop.

-Larry

Jan 31 '07 #3
On 31 jan, 01:03, Larry Bates <larry.ba...@websafe.comwrote:
TimD...@gmail.com wrote:
Hello,
I'm writing a python script for Amarok, I communicate with Amarok
using DCOP.
Now, I have to call DCOP very often and I noticed that every time I
make a DCOP call my program keeps growing in memory size.
To make sure it was DCOP i wrote the small program below:
from dcopext import DCOPClient, DCOPApp
while 0==0:
dcop=DCOPClient()
dcop.attach()
AmarokDcopRes = DCOPApp ("amarok", dcop)
ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs()
print Ms
If you run this script and monitor it's memory use you'll see that it
keeps growing.
Does anyone know how I can solve this problem?
Kind regards,
Tim

I think you will find the objects are getting created so fast that
garbage collection doesn't have time to clean them up as fast
as you are creating new ones. Since del dcop is not guaranteed
to be "immediate" that won't help.

Q: Can't you create dcop instance outside the loop and reuse it
for every time through the loop?

Q: Can you sleep or something after each loop or do you really
want to peg the CPU checking forever?

Q: How do you ever get out of this infinite loop?
Note: while 0=0 is better written as while 1: and you need a
break somewhere to get out of the loop.

-Larry
Hi,

Thanks for the quick response.

The code I posted is not my actual program and was only to demonstrate
my problem. The complete program I'm writing uses QT and so the loop
is replaced by a Timer event.
I tried out the suggestion. I had already tried the del dcop
instruction, so I knew that wasn't it. I also placed the DCOP variable
outside my loop but that didn't help either.
What I did notice that my program only grew in memory use when the
'ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs() ' code was
executed (or any other function using the AmarokDcopRes variable like
'ok, volume = AmarokDcopRes.player.getVolume()' )
Then I also tried to make my take a pause of a second in the loop but
this also didn't help, the program was still growing in memory use (a
lot slower though but I don't call that a solution)

So if you have any more ideas let me know. I'll keep on trying

Kind regards,

Tim

Jan 31 '07 #4
On Jan 31, 6:46 pm, "TimD...@gmail.com" <TimD...@gmail.comwrote:
The code I posted is not my actual program and was only to demonstrate
my problem. The complete program I'm writing uses QT and so the loop
is replaced by a Timer event.
I tried out the suggestion. I had already tried the del dcop
instruction, so I knew that wasn't it. I also placed the DCOP variable
outside my loop but that didn't help either.
You might get a precise answer to your question if you send a message
to the PyQt/PyKDE mailing list:

http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

The original authors and contributors of various Python DCOP modules
read that list, so there's a chance they can either solve your problem
or offer some advice on how to work around it.
What I did notice that my program only grew in memory use when the
'ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs() ' code was
executed (or any other function using the AmarokDcopRes variable like
'ok, volume = AmarokDcopRes.player.getVolume()' )
Do you find the same problem with other DCOP interfaces?

David

Jan 31 '07 #5
On 31 jan, 19:51, "David Boddie" <d...@boddie.org.ukwrote:
On Jan 31, 6:46 pm, "TimD...@gmail.com" <TimD...@gmail.comwrote:
The code I posted is not my actual program and was only to demonstrate
my problem. The complete program I'm writing uses QT and so the loop
is replaced by a Timer event.
I tried out the suggestion. I had already tried the del dcop
instruction, so I knew that wasn't it. I also placed the DCOP variable
outside my loop but that didn't help either.

You might get a precise answer to your question if you send a message
to the PyQt/PyKDE mailing list:

http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

The original authors and contributors of various Python DCOP modules
read that list, so there's a chance they can either solve your problem
or offer some advice on how to work around it.
What I did notice that my program only grew in memory use when the
'ok, Ms = AmarokDcopRes.player.trackCurrentTimeMs() ' code was
executed (or any other function using the AmarokDcopRes variable like
'ok, volume = AmarokDcopRes.player.getVolume()' )

Do you find the same problem with other DCOP interfaces?

David
Hi David,

I did tried out some other DCOP calls from other programs and I have
the same problem.

I followed your suggestion to subcribe and poste to the pyKDE mailing
list. I hope they can help me there.

Thanks,

Tim

Jan 31 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: qwweeeit | last post by:
Hi all, in my cross-reference tool I have the need to highlight the variables (by printing them in bold). I am using the kwrite editor, and I am not able to control it from python. I was...
8
by: ranjeet.gupta | last post by:
Dear All Is the Root Cause of the Memory corruption is the Memory leak, ?? suppose If in the code there is Memory leak, Do this may lead to the Memory Corruption while executing the program ? ...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
4
by: Don Nell | last post by:
Hello Why is there a memory leak when this code is executed. for(;;) { ManagementScope scope = new ManagementScope(); scope.Options.Username="username"; scope.Options.Password="password";...
20
by: jeevankodali | last post by:
Hi I have an .Net application which processes thousands of Xml nodes each day and for each node I am using around 30-40 Regex matches to see if they satisfy some conditions are not. These Regex...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
8
by: Adrian | last post by:
Hi I have a JS program that runs localy (under IE6 only) on a PC but it has a memory leak (probably the known MS one!) What applications are there that I could use to look at the memory usage of...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
22
by: Peter | last post by:
I am using VS2008. I have a Windows Service application which creates Crystal Reports. This is a multi theaded application which can run several reports at one time. My problem - there is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.