Memory leak fixes and a little new debug functionality

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17803 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-10-08 15:03:58 +00:00
parent 1c51fc5389
commit 7a9e11fdbf
6 changed files with 160 additions and 21 deletions

View file

@ -132,6 +132,16 @@ GS_EXPORT void GSDebugAllocationActiveRecordingObjects(Class c);
*/
GS_EXPORT NSArray *GSDebugAllocationListRecordedObjects(Class c);
/**
* This function associates the supplied tag with a recorded
* object and returns the tag which was previously associated
* with it (if any).<br />
* If the object was not recorded, the method reurns nil<br />
* The tag is retained while it is associated with the object.<br />
* See also the NSDebugFRLog() and NSDebugMRLog() macros.
*/
GS_EXPORT id GSDebugAllocationTagRecordedObject(id object, id tag);
/**
* Used to produce a format string for logging a message with function
* location details.
@ -288,6 +298,29 @@ GS_EXPORT BOOL NSDeallocateZombies;
NSString *fmt = GSDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, format); \
NSLog(fmt , ## args); }} while (0)
/**
* This macro saves the name and location of the function in
* which the macro is used, along with a short string msg as
* the tag associated with a recorded object.
*/
#define NSDebugFRLog(object, msg) \
do { \
NSString *tag = GSDebugFunctionMsg( \
__PRETTY_FUNCTION__, __FILE__, __LINE__, msg); \
GSDebugAllocationTagRecordedObject(object, tag); } while (0)
/**
* This macro saves the name and location of the method in
* which the macro is used, along with a short string msg as
* the tag associated with a recorded object.
*/
#define NSDebugMRLog(object, msg) \
do { \
NSString *tag = GSDebugMethodMsg( \
self, _cmd, __FILE__, __LINE__, msg); \
GSDebugAllocationTagRecordedObject(object, tag); } while (0)
#else
#define NSDebugLLog(level, format, args...)
#define NSDebugLog(format, args...)
@ -295,6 +328,8 @@ GS_EXPORT BOOL NSDeallocateZombies;
#define NSDebugFLog(format, args...)
#define NSDebugMLLog(level, format, args...)
#define NSDebugMLog(format, args...)
#define NSDebugFRLog(object, msg)
#define NSDebugMRLog(object, msg)
#endif