|
2001-04-03
| ||
| 13:32 | • Ticket [219391ffff] memory access violation upon exit status still Closed wi... artifact: 902123f978 user: hobbs | |
| 13:32 | • Closed ticket [219391ffff]. artifact: 68a1db74a5 user: hobbs | |
|
2001-03-31
| ||
| 14:51 | • Ticket [219391ffff]: 7 changes artifact: 3f2c1d422a user: hobbs | |
|
2001-02-01
| ||
| 06:19 | • Ticket [219391ffff]: 4 changes artifact: 4142957b95 user: dgp | |
|
2001-01-31
| ||
| 18:06 | • Ticket [219391ffff]: 5 changes artifact: 33dbd9d34d user: dkf | |
|
2000-11-15
| ||
| 22:00 | • Ticket [219391ffff]: 1 change artifact: ebcd1f9293 user: dkf | |
|
2000-10-26
| ||
| 05:12 | • New ticket [219391ffff]. artifact: 0a2c7bfd21 user: nobody | |
memory access violation upon exit
Closed / Fixed219391ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 05:12:15
OriginalBugID: 6163 Bug
Version: 8.3.1
SubmitDate: '2000-08-23'
LastModified: '2000-10-25'
Severity: SER
Status: UnAssn
Submitter: techsupp
OS: Windows NT
OSVersion: NT 4
Machine: Dell Pentium II
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'
Name:
Jiang Wu
CVS:
tclEvent.c,v 1.8 tclCkalloc.c,v 1.7
Extensions:
none
CustomShell:
none
Comments:
On Windows, if you type in "exit" on the shell, Tcl_Finalize() is
called. Then the dll is unloaded. The dll exit handler also calls
Tcl_Finalize().
The patch for tclEvent.c moves the thread local storage access inside
the "if (subsystemInitialized != 0) {", this way, a 2nd call to
Tcl_Finalize() during exit will not try to access Tcl subsystem such as
the debug memory allocation subsystem.
The patch for tclCkalloc.c resets the static global "curTagPtr" to NULL
after finalizing the memory subsystem. This allows the memory subsystem
to work again after finalization.
Without the patches, a 2nd call to Tcl_Finalize() triggers an access to
the thread local, which in turn triggers memory allocation in the Tcl
memory subsystem after the 1st Tcl_Finalize(). Because the curTagPtr
was not NULL'ed, Tcl memory allocation tries to use the already free'ed
pointer "curTagPtr". That caused the memory access violation on
Windows.
ReproducibleScript:
1. Compile Tcl with DEBUGDEFINES = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS on Windows NT.
2. Run "tclsh8.3d.exe" and type in the following:
memory tag foo
exit
ObservedBehavior:
Upon exit, the tclsh83d.exe produces an memory violation dialog:
The instruction at "0x1001dd9f" referenced memory at "0x0031c550". The memory could not be "read".
Click on OK to terminate the application
DesiredBehavior:
Program exits cleanly.
Patch:
*** tclEvent.c Wed Aug 23 14:12:40 2000
--- tclEvent.c.fixed Wed Aug 23 14:08:50 2000
***************
*** 744,752 ****
ThreadSpecificData *tsdPtr;
TclpInitLock();
- tsdPtr = TCL_TSD_INIT(&dataKey);
if (subsystemsInitialized != 0) {
subsystemsInitialized = 0;
/*
* Invoke exit handlers first.
--- 744,753 ----
ThreadSpecificData *tsdPtr;
TclpInitLock();
if (subsystemsInitialized != 0) {
subsystemsInitialized = 0;
+
+ tsdPtr = TCL_TSD_INIT(&dataKey);
/*
* Invoke exit handlers first.
*** tclCkalloc.c Wed Aug 23 14:12:56 2000
--- tclCkalloc.c.fixed Wed Aug 23 14:09:00 2000
***************
*** 983,988 ****
--- 983,989 ----
}
if (curTagPtr != NULL) {
TclpFree((char *) curTagPtr);
+ curTagPtr = NULL;
}
allocHead = NULL;
Tcl_MutexUnlock(ckallocMutexPtr);
PatchFiles:
tclEvent.c
tclCkalloc.c
dkf Ticket [219391ffff]: 1 change
[History diff]2000-11-15 22:00:21
dkfplain2001-01-31 18:06:21
(This fix really falls across a couple of functional areas, some of which are really not named very usefully. What this is is an interaction between the memory allocator, finalization subsystem, and the Win32 platform support...)
dgpplain2001-02-01 06:19:07
Registered patch as #103532
hobbsplain2001-03-31 14:51:01
Logged In: YES user_id=72656 fixed in 8.4a2cvs. This also fixed the problem in 8.4a2 where dynamically loading Tk in tclsh on Windows would cause a memory error upon exiting.
hobbsplain2001-04-03 13:32:10
Logged In: YES user_id=72656 forgot to mark this closed...
hobbs Ticket [219391ffff]: 2 changes
[History diff]2001-04-03 13:32:11
Log in (anonymous is fine) to add a comment.