Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Python memory management

2 views
Skip to first unread message

Marcelo A. Camelo

unread,
Aug 27, 2003, 12:43:00 PM8/27/03
to
Hi!

I will be presenting Python to an audience of game developers, mostly
C/C++ programmers. In my presentation I will talk about using python and
C/C++ extension instead of pure C/C++ to write commercial games and
content creation tools.

In a number of times I have presented these ideas to this same kind of
audience and they were received with cold skepticism, despite the fact
that some, including me, are already doing this with quite some success.

I've noticed that, from all their concerns, the most difficult to tackle
(for me, at least) is memory management.

Currently, the most popular platform for game applications are videogame
consoles. Memory on these special purpose machines are a premium
resource and one should used it judiciously. Python's RTE footprint and
memory fragmentation issues make it a hard sell for game programmers
(many tend to prefer LUA).

I would like to address this topic in my presentation, showing the real
picture about python memory habits and how to gain control over memory
management when using Python. So, I'm looking the references on the
subject. Also, I would like to hear comments from those with experience
in tweaking python's memory management.

Cheers,

Marcelo A. Camelo, M. Eng. - Project Leader
ESSS - Engineering Simulation and Scientific Software

E-mail: cam...@esss.com.br
Phone: +55-48-334-8922


Michael Hudson

unread,
Aug 27, 2003, 2:23:37 PM8/27/03
to
"Marcelo A. Camelo" <cam...@esss.com.br> writes:

> Currently, the most popular platform for game applications are videogame
> consoles. Memory on these special purpose machines are a premium
> resource and one should used it judiciously. Python's RTE footprint and
> memory fragmentation issues make it a hard sell for game programmers
> (many tend to prefer LUA).

Um, *I*, at least, would say they have a point. I love Python and
think it has many, many virtues, but being miserly with RAM is not one
of them (at least, for the current implementation).

If you're on a real PC, things are very different, of course.

Cheers,
mwh

--
Darned confusing, unless you have that magic ingredient coffee, of
which I can pay you Tuesday for a couple pounds of extra-special
grind today. -- John Mitchell, 11 Jan 1999

Marcelo A. Camelo

unread,
Aug 27, 2003, 3:52:47 PM8/27/03
to
> From: python-l...@python.org
> [mailto:python-l...@python.org] On Behalf Of Michael Hudson

>
> "Marcelo A. Camelo" <cam...@esss.com.br> writes:
>
> > Currently, the most popular platform for game applications are
> > videogame consoles. Memory on these special purpose machines are a
> > premium resource and one should used it judiciously. Python's RTE
> > footprint and memory fragmentation issues make it a hard
> > sell for game programmers (many tend to prefer LUA).
>
> Um, *I*, at least, would say they have a point. I love
> Python and think it has many, many virtues, but being miserly
> with RAM is not one of them (at least, for the current
> implementation).

Yes, I will be saying that. But, if I can't change the way Python
behaves, at least I want a way to diagnose what he is doing. I've found
some references about Pymalloc, now the default Python memory manager,
and how it can report statistics about memory usage, but the
documentation is a bit light on details. Any pointer to some resources
on the subject? Maybe python-dev is a better place to ask these
questions.

Thank you any way,

--camelo


Steven Taschuk

unread,
Aug 27, 2003, 5:31:02 PM8/27/03
to
Quoth Marcelo A. Camelo:
[...]

> Yes, I will be saying that. But, if I can't change the way Python
> behaves, at least I want a way to diagnose what he is doing. I've found
> some references about Pymalloc, now the default Python memory manager,
> and how it can report statistics about memory usage, but the
> documentation is a bit light on details. Any pointer to some resources
> on the subject? [...]

There's Misc/SpecialBuilds.txt in the source distribution, which
documents several build-time options which could be used for such
investigations. (It assumes some familiarity with the internals.)

--
Steven Taschuk stas...@telusplanet.net
"I may be wrong but I'm positive." -- _Friday_, Robert A. Heinlein

Aahz

unread,
Sep 7, 2003, 3:52:15 PM9/7/03
to
In article <mailman.1062002453...@python.org>,

Marcelo A. Camelo <cam...@esss.com.br> wrote:
>
>I've noticed that, from all their concerns, the most difficult to tackle
>(for me, at least) is memory management.
>
>Currently, the most popular platform for game applications are videogame
>consoles. Memory on these special purpose machines are a premium
>resource and one should used it judiciously. Python's RTE footprint and
>memory fragmentation issues make it a hard sell for game programmers
>(many tend to prefer LUA).

As Michael Hudson said, those are real issues. Nevertheless, the
increasing power of game consoles renders the first issue less
important, and PyMalloc (standard in Python 2.3) does much to alleviate
the second issue.
--
Aahz (aa...@pythoncraft.com) <*> http://www.pythoncraft.com/

This is Python. We don't care much about theory, except where it intersects
with useful practice. --Aahz

0 new messages