memory_mosq.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Copyright (c) 2010-2020 Roger Light <roger@atchoo.org>
  3. All rights reserved. This program and the accompanying materials
  4. are made available under the terms of the Eclipse Public License 2.0
  5. and Eclipse Distribution License v1.0 which accompany this distribution.
  6. The Eclipse Public License is available at
  7. https://www.eclipse.org/legal/epl-2.0/
  8. and the Eclipse Distribution License is available at
  9. http://www.eclipse.org/org/documents/edl-v10.php.
  10. SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
  11. Contributors:
  12. Roger Light - initial implementation and documentation.
  13. */
  14. #ifndef MEMORY_MOSQ_H
  15. #define MEMORY_MOSQ_H
  16. #include <stdio.h>
  17. #include <sys/types.h>
  18. #if defined(WITH_MEMORY_TRACKING) && defined(WITH_BROKER)
  19. # if defined(__APPLE__) || defined(__FreeBSD__) || defined(__GLIBC__)
  20. # define REAL_WITH_MEMORY_TRACKING
  21. # endif
  22. #endif
  23. void *mosquitto__calloc(size_t nmemb, size_t size);
  24. void mosquitto__free(void *mem);
  25. void *mosquitto__malloc(size_t size);
  26. #ifdef REAL_WITH_MEMORY_TRACKING
  27. unsigned long mosquitto__memory_used(void);
  28. unsigned long mosquitto__max_memory_used(void);
  29. #endif
  30. void *mosquitto__realloc(void *ptr, size_t size);
  31. char *mosquitto__strdup(const char *s);
  32. #ifdef WITH_BROKER
  33. void memory__set_limit(size_t lim);
  34. #endif
  35. #endif