Allow snapshots of memory for debugging.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22728 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-03-30 17:12:02 +00:00
parent bda7bd6385
commit 55edb29696
2 changed files with 43 additions and 7 deletions

View file

@ -1,7 +1,13 @@
2006-03-30 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSMemoryPanel.m: Extend to allow snapshots of the memory
to be taken so we can compare memory at different points in time.
2006-03-26 Maurizio Boriani <baux@gnu.org> 2006-03-26 Maurizio Boriani <baux@gnu.org>
* Resources/Italian.lproj/Localizable.string: Add missing translations. * Resources/Italian.lproj/Localizable.string: Add missing translations.
* Resources/Lojban.lproj/Localizable.string: New, lojban strings traslation. * Resources/Lojban.lproj/Localizable.string: New, lojban strings
translation.
2006-03-28 20:21 Gregory John Casamento <greg_casamento@yahoo.com> 2006-03-28 20:21 Gregory John Casamento <greg_casamento@yahoo.com>

View file

@ -184,6 +184,11 @@ static GSMemoryPanel *sharedGSMemoryPanel = nil;
/* Activate debugging of allocation. */ /* Activate debugging of allocation. */
GSDebugAllocationActive (YES); GSDebugAllocationActive (YES);
hbox = [GSHbox new];
[hbox setDefaultMinXMargin: 5];
[hbox setBorder: 5];
[hbox setAutoresizingMask: NSViewWidthSizable];
/* Button updating the table. */ /* Button updating the table. */
button = [NSButton new]; button = [NSButton new];
[button setBordered: YES]; [button setBordered: YES];
@ -192,13 +197,25 @@ static GSMemoryPanel *sharedGSMemoryPanel = nil;
[button setImagePosition: NSNoImage]; [button setImagePosition: NSNoImage];
[button setTarget: self]; [button setTarget: self];
[button setAction: @selector(update:)]; [button setAction: @selector(update:)];
[button setAutoresizingMask: NSViewMaxXMargin];
[button sizeToFit];
[button setTag: 1];
[hbox addView: button];
RELEASE (button);
/* Button taking snapshot of the table. */
button = [NSButton new];
[button setBordered: YES];
[button setButtonType: NSMomentaryPushButton];
[button setTitle: @"Snapshot"];
[button setImagePosition: NSNoImage];
[button setTarget: self];
[button setAction: @selector(snapshot:)];
[button setAutoresizingMask: NSViewMinXMargin]; [button setAutoresizingMask: NSViewMinXMargin];
[button sizeToFit]; [button sizeToFit];
[button setTag: 2];
hbox = [GSHbox new];
[hbox setDefaultMinXMargin: 5];
[hbox setBorder: 5];
[hbox setAutoresizingMask: NSViewWidthSizable];
[hbox addView: button]; [hbox addView: button];
RELEASE (button); RELEASE (button);
@ -279,7 +296,6 @@ static GSMemoryPanel *sharedGSMemoryPanel = nil;
- (void) dealloc - (void) dealloc
{ {
RELEASE(table);
RELEASE(classArray); RELEASE(classArray);
RELEASE(countArray); RELEASE(countArray);
RELEASE(totalArray); RELEASE(totalArray);
@ -321,6 +337,19 @@ static GSMemoryPanel *sharedGSMemoryPanel = nil;
return @""; return @"";
} }
- (void) snapshot: (id)sender
{
GSMemoryPanel *snapshot = [GSMemoryPanel new];
[snapshot setTitle:
[NSString stringWithFormat: @"Memory Snapshot at %@", [NSDate date]]];
[[[snapshot contentView] viewWithTag: 1] removeFromSuperview];
[[[snapshot contentView] viewWithTag: 2] removeFromSuperview];
[snapshot setReleasedWhenClosed: YES];
[snapshot makeKeyAndOrderFront: self];
[snapshot update: self];
}
- (void) update: (id)sender - (void) update: (id)sender
{ {
Class *classList = GSDebugAllocationClassList (); Class *classList = GSDebugAllocationClassList ();
@ -412,7 +441,8 @@ static GSMemoryPanel *sharedGSMemoryPanel = nil;
return; return;
} }
identifier = [[tableColumns objectAtIndex: selectedColumn] identifier]; identifier
= [(NSTableColumn*)[tableColumns objectAtIndex: selectedColumn] identifier];
if ([identifier isEqual: @"Class"]) if ([identifier isEqual: @"Class"])
{ {