Free memory for symbols when process is terminated.

svn path=/trunk/; revision=2474
This commit is contained in:
Casper Hornstrup 2002-01-02 21:00:55 +00:00
parent 7a30c6749a
commit 09bfe41894
2 changed files with 45 additions and 2 deletions

View file

@ -1,4 +1,4 @@
/* $Id: loader.c,v 1.93 2001/12/05 01:40:24 dwelch Exp $ /* $Id: loader.c,v 1.94 2002/01/02 21:00:55 chorns Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -630,6 +630,9 @@ LdrpLoadModuleSymbols(PMODULE_OBJECT ModuleObject)
ULONG Length; ULONG Length;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
ModuleObject->TextSection->Symbols.SymbolCount = 0;
ModuleObject->TextSection->Symbols.Symbols = NULL;
/* Get the path to the symbol store */ /* Get the path to the symbol store */
wcscpy(TmpFileName, L"\\SystemRoot\\symbols\\"); wcscpy(TmpFileName, L"\\SystemRoot\\symbols\\");
@ -729,6 +732,9 @@ VOID LdrLoadUserModuleSymbols(PLDR_MODULE ModuleObject)
ULONG Length; ULONG Length;
IO_STATUS_BLOCK IoStatusBlock; IO_STATUS_BLOCK IoStatusBlock;
ModuleObject->Symbols.SymbolCount = 0;
ModuleObject->Symbols.Symbols = NULL;
/* Get the path to the symbol store */ /* Get the path to the symbol store */
wcscpy(TmpFileName, L"\\SystemRoot\\symbols\\"); wcscpy(TmpFileName, L"\\SystemRoot\\symbols\\");

View file

@ -1,4 +1,4 @@
/* $Id: process.c,v 1.71 2001/12/05 01:40:25 dwelch Exp $ /* $Id: process.c,v 1.72 2002/01/02 21:00:02 chorns Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -25,6 +25,7 @@
#include <internal/dbg.h> #include <internal/dbg.h>
#include <napi/shared_data.h> #include <napi/shared_data.h>
#include <internal/pool.h> #include <internal/pool.h>
#include <roscfg.h>
#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
@ -263,6 +264,37 @@ PsInitProcessManagment(VOID)
&SystemProcessHandle); &SystemProcessHandle);
} }
#ifdef KDBG
VOID
PiFreeSymbols(PPEB Peb)
{
PLIST_ENTRY CurrentEntry;
PLDR_MODULE Current;
PSYMBOL NextSymbol;
PSYMBOL Symbol;
assert (Peb);
assert (Peb->Ldr);
CurrentEntry = Peb->Ldr->InLoadOrderModuleList.Flink;
while ((CurrentEntry != &Peb->Ldr->InLoadOrderModuleList) && (CurrentEntry != NULL))
{
Current = CONTAINING_RECORD (CurrentEntry, LDR_MODULE, InLoadOrderModuleList);
Symbol = Current->Symbols.Symbols;
while (Symbol != NULL)
{
NextSymbol = Symbol->Next;
ExFreePool (Symbol);
Symbol = NextSymbol;
}
Current->Symbols.SymbolCount = 0;
Current->Symbols.Symbols = NULL;
CurrentEntry = CurrentEntry->Flink;
}
}
#endif /* KDBG */
VOID STDCALL VOID STDCALL
PiDeleteProcess(PVOID ObjectBody) PiDeleteProcess(PVOID ObjectBody)
@ -274,6 +306,11 @@ PiDeleteProcess(PVOID ObjectBody)
KeAcquireSpinLock(&PsProcessListLock, &oldIrql); KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
RemoveEntryList(&((PEPROCESS)ObjectBody)->ProcessListEntry); RemoveEntryList(&((PEPROCESS)ObjectBody)->ProcessListEntry);
KeReleaseSpinLock(&PsProcessListLock, oldIrql); KeReleaseSpinLock(&PsProcessListLock, oldIrql);
#ifdef KDBG
PiFreeSymbols(((PEPROCESS)ObjectBody)->Peb);
#endif /* KDBG */
(VOID)MmReleaseMmInfo((PEPROCESS)ObjectBody); (VOID)MmReleaseMmInfo((PEPROCESS)ObjectBody);
ObDeleteHandleTable((PEPROCESS)ObjectBody); ObDeleteHandleTable((PEPROCESS)ObjectBody);
} }