473,587 Members | 2,324 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

hard memory limits

Hi,

I think I've hit a system limit in python when I try to construct a list
of 200,000 elements. My error is

malloc: vm_allocate (size = 2400256) failed......

Just wondering is this specific to my system or what? Will adding more
RAM helps in this case?

Thanks and cheers
Maurice
Jul 19 '05 #1
25 2695
Maurice LING wrote:
I think I've hit a system limit in python when I try to construct a list
of 200,000 elements.
there's no such limit in Python.
My error is

malloc: vm_allocate (size = 2400256) failed......

Just wondering is this specific to my system or what?
that doesn't look like a Python error (Python usually raises
MemoryError exceptions when it runs out of memory), and
there's no sign of any vm_allocate function in the Python
sources, so yes, it's a system-specific problem.
Will adding more RAM helps in this case?


probably. more swap space might also help. or you could use a
smarter malloc package. posting more details on your platform,
toolchain, python version, and list building approach might also
help.

(are you perhaps building multiple lists piece by piece, interleaved
with other object allocations? if so, it's probably a fragmentation
problem. to check this, watch the process size. if if grows at a
regular rate, and then explodes just before you get the above error,
you may need to reconsider the design a bit).

</F>

Jul 19 '05 #2
"Fredrik Lundh" <fr*****@python ware.com> writes:
Maurice LING wrote:
Will adding more RAM helps in this case?


probably. more swap space might also help. or you could use a
smarter malloc package. posting more details on your platform,
toolchain, python version, and list building approach might also
help.


Without platform information, it's hard to say. On a modern Unix
system, you only run into system resource limits when the system is
heavily loaded. Otherwise, you're going to hit per-process limits. In
the latter case, adding RAM or swap won't help at all. Raising the
per-process limits is the solution.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jul 19 '05 #3
On 5/6/05, Mike Meyer <mw*@mired.or g> wrote:
"Fredrik Lundh" <fr*****@python ware.com> writes:
Maurice LING wrote:
Will adding more RAM helps in this case?
probably. more swap space might also help. or you could use a
smarter malloc package. posting more details on your platform,
toolchain, python version, and list building approach might also
help.


Without platform information, it's hard to say. On a modern Unix
system, you only run into system resource limits when the system is
heavily loaded. Otherwise, you're going to hit per-process limits. In
the latter case, adding RAM or swap won't help at all. Raising the
per-process limits is the solution.


A quick google shows it to be mac os X, and a pretty frequent error message..

http://www.google.com/search?hl=en&q...=Google+Search

Peace
Bill Mill
bill.mill at gmail.com
<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
--
http://mail.python.org/mailman/listinfo/python-list

Jul 19 '05 #4
Mike Meyer wrote:
Without platform information, it's hard to say. On a modern Unix
system, you only run into system resource limits when the system is
heavily loaded. Otherwise, you're going to hit per-process limits. In
the latter case, adding RAM or swap won't help at all. Raising the
per-process limits is the solution.


does Mac OS X ship with memory limits set by default? isn't that
a single-user system?

</F>

Jul 19 '05 #5
On Friday 06 May 2005 10:29 am, Fredrik Lundh wrote:
Mike Meyer wrote:
Without platform information, it's hard to say. On a modern Unix
system, you only run into system resource limits when the system is
heavily loaded. Otherwise, you're going to hit per-process limits. In
the latter case, adding RAM or swap won't help at all. Raising the
per-process limits is the solution.


does Mac OS X ship with memory limits set by default? isn't that
a single-user system?

</F>


Dear original poster or whoever is interested in OS X:

OS X is not a single user system. It is BSD based unix. And its fv@king
sweeeeeeeeeeeee et! (Though I'm using only Linux right now :o/

If configurable memory limits are a problem and if running python from the
shell, do:

% unlimit

You can also change this in your .cshrc, .tcshrc, .bashrc, .k[whatever for
korn], etc. if you run a custom shell.

Your shell settings for each user are in NetInfo Manager.

If you are completely clueless as to what the hell I'm talking about, then
stop and try this:

1. start a Terminal
2. type this at the prompt:

% echo unlimit >> .bashrc

3. Quit that terminal.
4. Start a new terminal.
5. Start python and make your list.

Hope it works.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Jul 19 '05 #6
James Stroud wrote:
does Mac OS X ship with memory limits set by default? isn't that
a single-user system?


Dear original poster or whoever is interested in OS X:

OS X is not a single user system. It is BSD based unix. And its fv@king
sweeeeeeeeeeeee et! (Though I'm using only Linux right now :o/


Well, Apple's marketing materials contain no signs whatsoever that the
systems Apple sells are designed for massive numbers of users, compared
to systems from RedHat, Sun, HP, etc. (if you look at apple.com in this
very moment, it talks a lot about "your mac" and "your desktop" and "your
computer", not "the mac/desktop/computer you share with hundreds of
other users").

So why would Apple insist on setting unusably low process limits, when
the others don't?

</F>

Jul 19 '05 #7
On Friday 06 May 2005 11:27 am, Fredrik Lundh wrote:
James Stroud wrote:
does Mac OS X ship with memory limits set by default? isn't that
a single-user system?


Dear original poster or whoever is interested in OS X:

OS X is not a single user system. It is BSD based unix. And its fv@king
sweeeeeeeeeeeee et! (Though I'm using only Linux right now :o/


Well, Apple's marketing materials contain no signs whatsoever that the
systems Apple sells are designed for massive numbers of users, compared
to systems from RedHat, Sun, HP, etc. (if you look at apple.com in this
very moment, it talks a lot about "your mac" and "your desktop" and "your
computer", not "the mac/desktop/computer you share with hundreds of
other users").

So why would Apple insist on setting unusably low process limits, when
the others don't?

</F>


I think that two different markets exist for this computer:

1. Joe user who has never seen a command line interface. These people need a
nice, cozy little user environment that takes as little understanding as
possible to use. They also buy the most computers and are probably most
responsive to fluffy advertising campaigns. Hence the targeted advertising on
apple.com In this case, my guess is that memory allocation, etc, is left to
the application. For cocoa apps it is the objective c runtime handling this
kind of thing and for carbon apps, it is probobably tacked on during the
process of carbonizing. But I should say that I really don't know much about
the low level workings of either.

2. Scientists/Engineers/Programmer types. These people configure their own
limits instinctively and probably forgot that they ever put that unlimit in
their rc files (like I did) and the dozens of other customizations they did
to get their OS X boxes just so for unix use. When Joe User makes the
crossover, such customizations don't seem very intuitive. Plus, I remember
having to ulimit my IRIX account on SGIs I used back in the day--so other
*nixes seem to have similar requirements.

To answer your question, my guess is that no one has complained yet.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
Jul 19 '05 #8
"Fredrik Lundh" <fr*****@python ware.com> writes:
James Stroud wrote:
> does Mac OS X ship with memory limits set by default? isn't that
> a single-user system?


Dear original poster or whoever is interested in OS X:

OS X is not a single user system. It is BSD based unix. And its fv@king
sweeeeeeeeeeeee et! (Though I'm using only Linux right now :o/


So why would Apple insist on setting unusably low process limits, when
the others don't?


You're making an unwarranted assumption here - that the OP wasn't
creating a large process of some kind. IIRC, all we ever saw was the
size of the request that triggered the error, with no indication of
the total process size.

FWIW, OS X has a Mach kernel. The failing vm_malloc call listed in the
OP is a Mach call, not a Unix call. These days, the userland code is
largely FreeBSD. It used to include "the best of" OpenBSD, NetBSD and
FreeBSD at a relatively small level, but that headache was dropped in
favor of tracking one external system. The legacy of the mixed
heritage is utilities from NetBSD and OpenBSD that aren't in
FreeBSD. shlock comes to mind as an obvious example.

<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jul 19 '05 #9
On Fri, 06 May 2005 18:24:21 +1000, Maurice LING <ma*********@ac m.org>
wrote:
Hi,

I think I've hit a system limit in python when I try to construct a list
of 200,000 elements. My error is

malloc: vm_allocate (size = 2400256) failed......

Just wondering is this specific to my system or what? Will adding more
RAM helps in this case?


Not if it's an OS limit (see other posts). Not if you are doing
something so weird or drastic that you will use up the extra RAM and
still get the same message.

If you were to reply to Fredrik's question (HOW are you creating your
list), and this one: WHAT is an "element", we might be able to help
you avoid a trip to the Apple dealer.

As a bit of a reality check for you:
[numbers based on a 32-bit machine, CPython]

An extra list of 200000 ints will take up 800000 bytes (plus small
change) if the ints are all in range(-1, 101) and thus cached --
that's a 4-byte pointer (i.e. PyObject *) each.

If all the ints are outside that range, and are distinct, they'll take
(worst case) 16 bytes each (assuming you aren't using a debug build of
Python). The additional 12 bytes are for the int object: a reference
counter, a pointer to the type object, and the actual value. So you're
looking at approx 3.2MB.

In general, reckon on each element taking up 12+sizeof(eleme nt_value).

I'd suspect that your "elements" are not quite as elementary as ints,
and/or you are doing a whole lot of *other* memory allocation. Confess
all ...

Cheers,
John


Jul 19 '05 #10

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

Similar topics

0
1624
by: Zac | last post by:
I've been googling all day and I haven't seen anyone else having this problem, so I thought I'd check to see if I'm unique or I should be expecting this behavior. I've recompiled and reinstalled my PHP SO for Apache with the configure flag "--enable-memory-limit" I'm running Apache 2.0.52 and PHP 5.0.3 (on FreeBSD 5.3). After restarting...
4
2029
by: Matthew Dauphinee | last post by:
Is anybody out there pushing the memory limits ( for shared memory ) with DB2 version 8 on LINUX. The Advanced Admin IBM Press Book claims that kernel 2.4 can only grab 1.75 GB. We have just gotten RedHat Enterprise Linux AS release 3 ( kernel 2.4.21-9.0.1.ELcustom) and just by trying sizes, it looks like it can address an eyelash smaller...
7
2294
by: pervinder | last post by:
Hi, I have a c applicaiton which uses calloc to allocate the storage from heap. A page is allocated (4096bytes) and then its used in smal small chunks on need. It works fine till some n number of pages are alloacted and used. But it fails to allocate a fresh page of 4096 after some m times when the prev. block gets exhausted and new...
7
1849
by: Dan Nilsen | last post by:
Hi! I'm writing a small piece of software that basically runs on an embedded system with a Power-PC cpu. This runs on a stripped down version of Linux - Busybox. As I'm writing a piece of code that basically acts as a server and that will be running for weeks or months and probably even longer, memory management is a topic that is quite...
18
5117
by: Joe Lester | last post by:
This thread was renamed. It used to be: "shared_buffers Question". The old thread kind of died out. I'm hoping to get some more direction by rephrasing the problem, along with some extra observations I've recently made. The core of the problem is that Postgres is filling up my hard drive with swap files at the rate of around 3 to 7 GB per...
4
1470
by: david | last post by:
I've been working on an external C module for Python in order to use some of the functionality from Ethereal. Right now I'm getting segfaults originating from within the Ethereal source code, but the same code works fine when used normally (i.e. through Ethereal or Tethereal). I'm wondering if there's some sort of memory limitation the Python...
6
3315
by: Bob Bedford | last post by:
Hi all, I've to resize uploaded images with the "imagecopyresampled" but when I've images quite large (common those days) I reach the 16mb limits of the ISP. How can I fix this ? I absolutely need to resize such images. Bob
1
1618
by: DR | last post by:
what are the memory caps for threads running as a CLR stored procedure executed by sql server 2005? is it limited by OS only or also by sql servers memory limits? e.g. lets say my clr stored procedure is executed by sql server 2005 then it creates 10 threads and each thread builds a giant array on the stack, is the limits of each array limited...
31
1662
by: Chris Thomasson | last post by:
How many C compilers provide extensions which allow for a standard implementation of the following hack? ____________________________________________________________________ #include <stdio.h> typedef union aligner_types_u aligner_types; typedef struct aligner_offset_s aligner_offset;
0
7918
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8206
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5392
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
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 we have to send another system
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.