473,505 Members | 15,036 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python 3.3 urllib memory leakage

2 New Member
Im using mac mini with ios 10.9.2 and Python 3.3. I wrote simple Python app, which fetch api data and shows some calculation. Everything is working well, but i saw in Activity Monitor (os tool) that after few connections system memory usage incrases, but in my opinion it shouldnt. I wouldnt publish aplication that can eat all memory so I need a help.

Here is a pice of my code which makes this problem:

Expand|Select|Wrap|Line Numbers
  1. import urllib.request
  2. import time
  3.  
  4. class Main(object):
  5.     def Get(self, url):
  6.         urlData = urllib.request.urlopen(url)
  7.         for line in urlData:
  8.             line = str(line,'utf-8')
  9.             print( line.rstrip() )
  10.         urlData.close()
  11.         time.sleep(1)
  12.  
  13. M = Main()
  14. url = "https://btc-e.com/api/2/btc_usd/trades"
  15. b=1
  16.  
  17. while b>0:
  18.     M.Get(url)
  19.  
I tried to do in another way but it makes memory usage incrasing too:

Expand|Select|Wrap|Line Numbers
  1. req = request.urlopen('https://btc-e.com/api/2/btc_usd/trades')
  2. urlData = json.loads(req.read().decode('utf-8')) 
This makes memory usage higher too:

Expand|Select|Wrap|Line Numbers
  1. from urllib.request import urlopen
  2. html = urlopen("https://btc-e.com/api/2/btc_usd/trades")
Thank you in advance!
Apr 17 '14 #1
2 2474
dwblas
626 Recognized Expert Contributor
This question is better asked on a Mac forum where people know more about the OS than us. The short answer is it depends on which program you are using to display memory usage. Does it display real usage or shared memory usage. Also, the Mac OS is related to Linux in some way, and Linux allocates all the memory that a program might ever use, when the memory is available, and so some tools would report a lot of memory "used" even though that memory is just waiting there and is available for other programs.
Apr 17 '14 #2
formel
2 New Member
Thank You for answer.

I will check memory usage with other tool.
Is there any python 3.3 tool to check if memory was relased?
Apr 18 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3721
by: frustrated | last post by:
Before I begin, I must first make the following disclaimer: Although I have considerable programming experience, I do not consider myself by any means to be an expert C++ programmer. The following...
0
1784
by: boy | last post by:
Hi all, I have created a simple template class as follow, but i encountered memory leakage on the base.Render(writer). Have all you of encountered the same problem? using System; using...
7
1765
by: andylcx | last post by:
hi all: I have a code like below, is there any serious memory leakage in my code. I am confusion now but no idea how to fix it. In the member function of class A, I create a new object of class B...
18
2242
by: Ramasubbu Ramasubramanian XR (AS/EAB) | last post by:
What is memory leakage, could any one explain with sample code
1
3779
by: Gaël | last post by:
Hi everybody! I have a really big problem with ASP.NET application. I noticed that the w3wp.exe memory size, increase with the time and the use of my website. When it raise a certain value, w3wp...
2
1385
by: chets | last post by:
Hi all Can anyone tell me what is the difference between:- *p=q; and p=&q; in C where declaration is like this char **p; char *q; Because if I do *p=q; in one file after mallocing q and...
0
1353
by: kiran kumar | last post by:
Hi All, I am working on embedded python on C these days. I feel there is a memory leakage in this code. I have used our own memory pool and all the python code will use the heap from this memory...
14
2323
by: madhawi | last post by:
i want to know that on what situation memory leakage happan and what is the solution to solve the problem of memory leakage.
11
2265
by: prpradip | last post by:
I have an ImageList (_imageList). In _imageList I have put large numbers of Icons. Now what I need is to get Handle of all Icons that I put in _imageList, so that I can destroy (DestoryIcon) them...
0
7098
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
7303
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
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
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...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.