473,387 Members | 1,512 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,387 software developers and data experts.

Python 3.3 urllib memory leakage

2
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 2470
dwblas
626 Expert 512MB
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
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
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
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
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
by: Ramasubbu Ramasubramanian XR (AS/EAB) | last post by:
What is memory leakage, could any one explain with sample code
1
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.