J
jacob navia
William said:Because although it will "work" without being more efficient, it may
have very long pauses, and may be so slow as to be useless.
You do not have to rewrite code to get it to work, but you
may have to rewrite code to get it to work usefully. (And worse, you
may be unable to rewrite code to get it to work usefully)
Excuse me but you tell us that your program uses 1GB of RAM.
This is not a normal application, and you may need to
optimize your usage.
Besides, you are having NOW a pause each time you do a free() since
free() will try to consolidate memory. If you use a bad malloc package
that doesn't do that, you have a lot of that GB of RAM in very small
chunks, unusable!
If your program is using 1GB of RAM you must pay attention to RAM usage
more so than in a normal application sorry.
And if you have large data structures that do contain pointers
you are SOL. Being told that "most programs" do not have this problem
is cold comfort.
What do you expect?
Most applications do not use 1GB RAM!
And this does not address the problem of memory allocation in
libraries not under your control (no you cannot simply link them
with another malloc/free as you will then have two mallocs working
on the same address space and same physical memory).
GC_malloc is compatible with malloc/free. You should not MIX both,
i.e. giving a GC_malloced chunk to free().