Liste des Groupes | Revenir à cl c |
Michael S <already5chosen@yahoo.com> writes:
[...]Is there any chance at all that on typical Linux machine (i.e. the one>
configured to overcommit virtual memory) strdup() returns NULL?
If it was malloc() I'd say - no chance. For strdup() I'm less sure.
strdup() calls malloc(), so strdup() can return NULL if and only if
malloc() can return NULL -- but with the additional constraint that you
first need to have a string argument to strdup() that's long enough to
cause a suffiently large argument to be passed to malloc().
>
One data point: On my Ubuntu system, malloc(SIZE_MAX) returns NULL for
very large arguments (over about 23 GiB in my quick and dirty test).
Les messages affichés proviennent d'usenet.