Take the tour ×  Is the concept of OOP intimately tied to
allocating objects on the heap? Is it possible to write normal
OOP without creating excessive objects on the heap?
share|improve this question add comment  migrated from
superuser.com Jan 9 at 19:21   2 Answers  up vote 2 down vote
accepted  No, OOP has nothing to do with where objects reside in
memory. For example, instances of the same class can be
allocated statically, on the heap, or on the stack in C++. In
other languages, like Python, memory management is almost
transparent, so the question of location doesn't really apply.
share|improve this answer Well, the question of location applies
when you look at the implementation. And most implementations
allocated practically everything dynamically (though the
downsides are offset by tuning the way that memory is
allocated). However, PyPy sometimes removes dynamic allocations
completely (if the JIT compiler can prove they don't escape),
and sometimes optimizes them (delays them, doing some work witho