Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Memory allocation

Reply
Thread Tools

RE: Memory allocation

 
 
Batista, Facundo
Guest
Posts: n/a
 
      09-22-2003
#- Knowing how much memory the object consumes will not help you with
#- that, at least in general. The object could easily be changed in a
#- dozen ways yet still consume the same amount of memory.

No, sorry. Knowing how much memory consumes, gives me if it's a viable
solution.


#- Can't the object just track changes to itself? This is a fairly
#- common solution to the general problem you describe. Resorting to
#- things like checking memory consumption is not likely the best way
#- to approach this.

Thought this. But gives me an API not separated from my main code (I have to
subclass each class from another one).


#- > but it still remains a general question: the other
#- > day I wanted to know "how much more expensive in memory is
#- a list than a
#- > tuple for a given content".
#-
#- I believe the answer was given, but in case it wasn't: they take
#- effectively the same amount of memory, as each is basically a series
#- of pointers to other objects.

That's OK.

But, there is a way to know the memory consumption?

 
Reply With Quote
 
 
 
 
Simon Bayling
Guest
Posts: n/a
 
      09-22-2003
I don't know about memory usage, but can you use
>>> hash(pickledItem)


Hashing is a very common way to confirm accuracy in file downloads, for
instance.

- Simon.

"Batista, Facundo" <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> #- Can't the object just track changes to itself? This is a fairly
> #- common solution to the general problem you describe. Resorting to
> #- things like checking memory consumption is not likely the best way
> #- to approach this.
>
> Thought this. But gives me an API not separated from my main code (I
> have to subclass each class from another one).

 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      09-22-2003
"Batista, Facundo" wrote:
>
> #- Knowing how much memory the object consumes will not help you with
> #- that, at least in general. The object could easily be changed in a
> #- dozen ways yet still consume the same amount of memory.
>
> No, sorry. Knowing how much memory consumes, gives me if it's a viable
> solution.


Hmm... you mean the memory consumption had nothing to do with detecting
the change? You just want to know if holding the pickled object in
memory is viable? If that's what you mean, I must be missing something...
a pickle is just a serialized (i.e. flat) representation of the data
as a series of bytes, right? In other words, a string? So call len()
on it... (as I said, that sounds too easy so I must be missing something).

> But, there is a way to know the memory consumption?


Not really, although I suspect there have been past postings to the
newsgroup (maybe check the archives) in which people have experimented
with partial solutions to this problem. It's not generally something
that seems to come up very often.

-Peter
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
An idea for heap allocation at near stack allocation speed Bjarke Hammersholt Roune C++ 14 03-06-2011 08:07 AM
static memory allocation versus dynamic memory allocation Ken C Programming 24 11-30-2006 12:37 AM
What is the difference between dynamic memory allocation,and stack allocation ? chris C++ 6 10-28-2005 05:27 AM
memory allocation and freeing memory Rodrigo Dominguez C Programming 11 06-14-2005 11:54 PM
Dynamic memory allocation and memory leak... s.subbarayan C Programming 10 03-22-2005 02:48 PM



Advertisments