+ 8

What's the memory limit in Sololearn?

I wanted to check if the connection to Google API would work from Sololearn. Other external links work, why shouldn't this one, right? I wrote a script in Python and ran it. Turned out the connection is okay, but when I wanted to pull some data from it (either XML or json), the console output says "Memory limit exceeded". So what is the limit anyway and is there a chance it could be at least a bit higher?

21st Jan 2017, 12:27 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
10 Respostas
+ 8
That settles it, thanks for clarifying, @Kirk!
3rd Mar 2017, 6:12 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
Take a look here, on my GeoProject - I'm trying to pull some 1.5kb of XML data: https://code.sololearn.com/c57gr6Ay31s9/#py
21st Feb 2017, 6:58 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 6
Okay, I finally got CentOS 7 on my Android tablet, and a full Python install. [Rant*] ... here's a followup answer: $ python -m memory_profiler test.py Filename: test.py Line # Mem usage Increment Line Contents ==================================== 15 7.988 MiB 0.000 MiB @profile 16 def imports(): 17 10.359 MiB 2.371 MiB from urllib.request import urlopen as OPEN 18 10.359 MiB 0.000 MiB from urllib.parse import urlencode as ENCODE 19 10.641 MiB 0.281 MiB from xml.etree import ElementTree as XML "urllib" uses 2.371 MiB. Combined with the earlier memory check, that single import is too big by more than 2x. You may notice the second import (line 18) doesn't​ matter (Python's already got the whole module in memory). * Rant: Google's been pushing NEON CPU code to an unlucky group (me included) and it killed my OS...I've spent most of my time man-in-middling it / keeping it super lockdown (I have to socket SoloLearn stuff to my phone), but...
3rd Mar 2017, 1:03 AM
Kirk Schafer
Kirk Schafer - avatar
+ 5
Can you show that portion of your script? I have a snippet here that allocates more than that, but another piece of code where it gets stuck about 4-6K either direction from a pointer. It would be nice to correlate a little (or maybe add the API myself and test?)
6th Feb 2017, 9:12 PM
Kirk Schafer
Kirk Schafer - avatar
+ 5
I'm getting a little over 1MB available to Python (wrote a heap iterator here: https://code.sololearn.com/cKVeedVg6sZV/?ref=app ). It varies slightly between runs. Testing...your first import fails/doesn't fail so it may be at the memory threshold. The second import succeeds more often. I have only Android + QPython (which is out of date) so I don't know if I can test import sizes. You could use my program at home, but you have nice import tests available: import resource, psutil, and especially memory_profiler: https://pypi.python.org/pypi/memory_profiler
22nd Feb 2017, 1:33 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
Maybe you should try running generators for that. But I don't know of the memory limit. You have to consider that SoloLearn has many users and limited servers. So I would think it is in the megabytes range
22nd Jan 2017, 1:45 AM
Amaras A
Amaras A - avatar
+ 2
Might be. But the data pulled is some 1500 bytes altogether... Shouldn't be that much of a problem, no?
31st Jan 2017, 6:30 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
ok, kB, then
4th Feb 2017, 1:04 PM
Amaras A
Amaras A - avatar
+ 2
I tried to get down to 1200 bytes, but it still exhausts the limit. Probably not really a question of memory, but the method of accessing it in the virtual environment of Sololearn...
4th Feb 2017, 10:05 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Thanks man, I'll try that.
22nd Feb 2017, 6:35 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar