Re: Memory Allocation?

From: M.E.Farmer (mefjr75_at_hotmail.com)
Date: 02/08/05


Date: 7 Feb 2005 19:28:56 -0800

Chris S. wrote:
>Using similar logic, we shouldn't need access to the Garbage Collector
>or Profiler. After all, why would anyone need to know how fast their
>program is running or whether or not their garbage has been collected.
>Python takes care of it.
Exactly! Even though there are a few who just won't listen ;)
I answered earlier that the *way* CPython allocates and uses memory it
was kinda useless. Similar objects in CPython and Jython and .etc..
have different implementions and consequently have different memory
footprints. Do you just want to keep track of average memory? Or do you
want know exactly when an object is collected and the memory is freed?
 If so, that is also one of those grey areas of Python, objects are
collected and memory is freed at differing times , depending on several
factors plus the phase of the moon.
Lots of devils and plenty of details. If I am wrong someone correct me
;)
If you search around you can find many pointers to memory effecient
coding style in Python( never add a string together, use a list and
append then join, etc.)
Stick to profiling it will serve you better. But do not let me stop you
from writing a memory profiler ;)
M.E.Farmer



Relevant Pages

  • Re: Garbage Collection
    ... Letting the GC be able to recycle the memory of parts of a collection/datastructure before the whole collection/datastructure itself leaves the scope. ... Say some programmer with a limited data set and a non-deterministic garbage collector has to iterate through this 10 times during testing. ... But when you put that same situation in the real world where you might have to iterate through 50,000 items, periodically the user is going to curse the computer when he can't move the mouse because some background garbage collection process steals his cpu while managing all this memory that has been abandoned. ...
    (borland.public.delphi.non-technical)
  • Re: Garbage collected types
    ... collector information won't be available for all types (and memory ... they won't have my garbage collector support. ... my intention is to build a precise garbage collector. ... untraced pointers to be stored in the collected heap. ...
    (comp.compilers)
  • Re: Memory leak when using Response.Write()
    ... It will be collected when the garbage collector is run, and that only happens when the memory is needed, or when the garbage collector thinks that it's convenient to do a collection. ... If your application uses and releases a lot of objects, you would observe a sawtooth like curve where the memory usage increases to a certain point until a garbage collection occurs and frees up a ot of memory at once. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Performance monitoring indicates that GC is not running?
    ... but I haven't consumed enough memory to ... the .NET CLR Memory counters. ... > using a memory profiler instead of windows task manager for an accurate ... the collector should run and the memory should fall back down. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Performance monitoring indicates that GC is not running?
    ... you probably do have a genuine problem. ... a memory profiler instead of windows task manager for an accurate picture. ... When memory gets above 60% or so, the collector should ...
    (microsoft.public.dotnet.framework.performance)