Liste des Groupes | Revenir à cl c |
On Thu, 7 Mar 2024 11:35:08 +0100No, GC alone does not do that. But heap compaction is generally done as part of a GC cycle.
David Brown <david.brown@hesbynett.no> wrote:
On 06/03/2024 23:00, Michael S wrote:GC does not stop fragmentation, but it allow heap compaction to beOn Wed, 6 Mar 2024 12:28:59 +0000Garbage collection does not stop heap fragmentation. GC does, I
bart <bc@freeuk.com> wrote:
>>
"Rust uses a relatively unique memory management approach that
incorporates the idea of memory “ownership”. Basically, Rust keeps
track of who can read and write to memory. It knows when the
program is using memory and immediately frees the memory once it
is no longer needed. It enforces memory rules at compile time,
making it virtually impossible to have runtime memory bugs.⁴ You
do not need to manually keep track of memory. The compiler takes
care of it."
>
This suggests the language automatically takes care of this.
Takes care of what?
AFAIK, heap fragmentation is as bad problem in Rust as it is in
C/Pascal/Ada etc... In this aspect Rust is clearly inferior to
GC-based languages like Java, C# or Go.
suppose, mean that you need much more memory and bigger heaps in
proportion to the amount of memory you actually need in the program
at any given time, and having larger heaps reduces fragmentation (or
at least reduces the consequences of it).
>
built-in part of environment.
So, it turns heap fragmentationFor high-level VM based languages, that could be correct. But low-level compiled and optimised languages are dependent on addresses remaining valid, so heap compaction is not an option.
from denial of service type of problem to mere slowdown, hopefully
insignificant slowdown.
I don't say that heap compaction is impossible in other environments,Agreed.
but it is much harder, esp. in environments where pointers are visible
to programmer. The famous David Wheeler's quote applies here at full
force.
Also when non-GC environments chooses to implement heap compaction they
suffer the same or bigger impact to real-time responsiveness as GC.
So, although I don't know it for sure, my impression is that genericI think that is likely.
heap compaction extremely rarely implemented in performance-aware
non-GC environments.
Performance-neglecting non-GC environments, first and foremost CPython,CPython does use garbage collection, as far as I know.
can, of course, have heap compaction, although my googling didn't give
me a definite answer whether it's done or not.
Les messages affichés proviennent d'usenet.