// Copyright 2012 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // Misc. common utility functions // // Author: Skal (pascal.massimino@gmail.com)
#include"src/utils/utils.h"
#include <assert.h> #include <stdlib.h> #include <string.h> // for memcpy()
// If PRINT_MEM_INFO is defined, extra info (like total memory used, number of // alloc/free etc) is printed. For debugging/tuning purpose only (it's slow, // and not multi-thread safe!). // An interesting alternative is valgrind's 'massif' tool: // https://valgrind.org/docs/manual/ms-manual.html // Here is an example command line: /* valgrind --tool=massif --massif-out-file=massif.out \ --stacks=yes--alloc-fn=WebPSafeMalloc--alloc-fn=WebPSafeCalloc ms_printmassif.out
*/ // In addition: // * if PRINT_MEM_TRAFFIC is defined, all the details of the malloc/free cycles // are printed. // * if MALLOC_FAIL_AT is defined, the global environment variable // $MALLOC_FAIL_AT is used to simulate a memory error when calloc or malloc // is called for the nth time. Example usage: // export MALLOC_FAIL_AT=50 && ./examples/cwebp input.png // * if MALLOC_LIMIT is defined, the global environment variable $MALLOC_LIMIT // sets the maximum amount of memory (in bytes) made available to libwebp. // This can be used to emulate environment with very limited memory. // Example: export MALLOC_LIMIT=64000000 && ./examples/dwebp picture.webp
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.1Bemerkung:
(vorverarbeitet am 2026-09-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.