Python Memory Footprint

Started by
4 comments, last by c t o a n 20 years, 7 months ago
Like I''ve said many times in this forum, I''m loading many scripts into memory for execution in my engine. However, I load ALL the scripts at the start of the engine, whether they''re running or not. I''m worried about how much memory Python will use up for these scripts. Does it store more or less information (in terms of bytes) then the .pyc (compiled python file) file the script is stored in? This is a future-looking discussion, cause if I''m going to change this, NOW would be a good time, as opposed to when I''ve already built all the scripts :S (I''m also using Boost.Python, does this add considerable amounts to the heap usage [don''t really care about the stack usage so much]) Thanks Chris Pergrossi My Realm | "Good Morning, Dave"
Chris PergrossiMy Realm | "Good Morning, Dave"
Advertisement
To answer your question: load up your engine with no scripts loaded, hit ctrl-alt-del, and look at your memory usage (assuming you have NT/XP). Now load up a whole bunch of scripts and check your memory usage. Now take the difference and compare that to the sum of the .pyc filesizes.

However, I would load only the scripts needed. Thinking ahead, what happenes when the scripting gets complex (you have an ai script for each class of actor, not to mention big fluffy dialogue scripts and level scripts)? It seems foolish to waste the memory.

Of course, if your scripts are trivial, and you forsee them STAYING trivial, well it''s your call.

--
Dustin
quote:Original post by thedustbustr
To answer your question: load up your engine with no scripts loaded, hit ctrl-alt-del, and look at your memory usage (assuming you have NT/XP). Now load up a whole bunch of scripts and check your memory usage. Now take the difference and compare that to the sum of the .pyc filesizes.

However, I would load only the scripts needed. Thinking ahead, what happenes when the scripting gets complex (you have an ai script for each class of actor, not to mention big fluffy dialogue scripts and level scripts)? It seems foolish to waste the memory.

Of course, if your scripts are trivial, and you forsee them STAYING trivial, well it''s your call.

--
Dustin


He is right. Don''t be worried. Most people these days have at least 128MB RAM. Most games need 256MB.

Scott Simontis
e-mail:ageofscott@comcast.net
AIM:ssimontis
Scott SimontisMy political blog
Aight, thanks guys. I''ve decided to rework my engine (after having just finished my filesystem) to load only the active scripts, and load the others as they''re needed. Thanks again.

Chris Pergrossi
My Realm | "Good Morning, Dave"
Chris PergrossiMy Realm | "Good Morning, Dave"

quote :
He is right. Don''t be worried. Most people these days have at least 128MB RAM. Most games need 256MB.


???


If you create shareware, thinking about people with old computers, with 64 meg is a _good_ idea.

And if you''re a pro, thinking about the consoles is a _very_good_ idea...
quote:Original post by c t o a n
Aight, thanks guys. I''ve decided to rework my engine (after having just finished my filesystem) to load only the active scripts, and load the others as they''re needed. Thanks again.


Actually, if you do eventually get an answer to the question you asked - whether empirically or from external sources, I''d be interested to know.

[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement