Liste des Groupes | Revenir à cl c |
Kaz Kylheku <433-929-6894@kylheku.com> writes:Scott Lurndal <scott@slp53.sl.home> wrote:>Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes:>On 10/03/2024 18:47, Scott Lurndal wrote:>Kaz Kylheku <433-929-6894@kylheku.com> writes:>Not take up space in every application for a common library routine.
It's a form of lazy programming. I've seen a lot of open source
code that uses strdup without checking for failure and frequently
"forgetting" to free the result.
And it is probably more likely that machine with many gigabytes of RAM
Actually, your assumptions that:
1) strdup is the only allocation function used by an application
2) all strings are "short"
Even if a string is long enough to need its own mmap request,
that will still return valid memory that later fails to commit.
Since strdup necessarily writes to almost all the memory it allocates,
you’d expect the failure to be immediate.
Les messages affichés proviennent d'usenet.