Guiliani  Version 2.5 revision 7293 (documentation build 13)
GUIMemLeakWatcher.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
13#ifndef __GUI_MEM_LEAK_WATCHER_H__
14#define __GUI_MEM_LEAK_WATCHER_H__
15
16// include custom-memory-mapping
17#include "eC_CustomMemoryMapping.h"
18
19#include <stddef.h>
20#include "GUIConfigDebug.h"
21
22#include "GUIMemLeakFunctions.h"
23
24// if you even want to overload the c-functions (malloc, realloc and free)
25// activate the define GUILIANI_OVERLOAD_C_FUNCS in GUIConfigDebug.h
26
27// Disable warning "4291: no matching operator delete found; memory will..."
28// on Visual C++ Compilers.
29#ifdef _WIN32
30#ifdef eC_TARGET_COMPILER_MSVC
31 #pragma warning(disable : 4291)
32#endif
33#endif
34
35#ifdef GUILIANI_OVERLOAD_CPP_FUNCS
36// undef operators
37#ifdef new
38 #undef new
39#endif
40
41#ifdef delete
42 #undef delete
43#endif
44
45// redefine operators
46#define new new(__FILE__,__LINE__,__FUNCTION__)
47#define delete Guiliani_info(__FILE__,__LINE__,__FUNCTION__),delete
48#endif
49
50#ifdef GUILIANI_OVERLOAD_C_FUNCS
51// undef functions
52#ifdef malloc
53 #undef malloc
54#endif
55
56#ifdef free
57 #undef free
58#endif
59
60#ifdef realloc
61 #undef realloc
62#endif
63
64// redefine functions
65#define malloc(x) Guiliani_malloc(x,__FILE__,__LINE__,__FUNCTION__)
66#define free(x) Guiliani_free(x,__FILE__,__LINE__,__FUNCTION__)
67#define realloc(x,y) Guiliani_realloc(x,y,__FILE__,__LINE__,__FUNCTION__)
68#endif
69
70#endif