|
2003-05-19
| ||
| 02:40 | • Closed ticket [736425ffff]: memory leaks in tclDate.c plus 7 other changes artifact: 04a6cc2cf2 user: kennykb | |
|
2003-05-14
| ||
| 10:15 | • Ticket [736425ffff]: 4 changes artifact: 9e31ca17ab user: mistachkin | |
| 06:03 | • Ticket [736425ffff]: 5 changes artifact: 207448791c user: hobbs | |
|
2003-05-12
| ||
| 18:27 | • Ticket [736425ffff]: 4 changes artifact: 085ec3b1b2 user: mistachkin | |
| 18:27 | • Add attachment datefix.c to ticket [736425ffff] artifact: b8a56e17ca user: mistachkin | |
| 11:27 | • New ticket [736425ffff] memory leaks in tclDate.c. artifact: 27f96860af user: mistachkin | |
memory leaks in tclDate.c
Closed / Fixed736425ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 24 years ago
Descriptionplain2003-05-12 11:27:58
generic/tclDate.c 1. Shouldn't this file be using ckalloc/ckrealloc? 2. The following variables are allocated and are never freed: int *TclDates; YYSTYPE *TclDatev; ----- It appears that we can override the use of malloc/realloc by defining the YYEXPAND preprocessor macro and having it call a function which does ckalloc/ckrealloc instead. As for the leak, I think since the only memory that is allocated by this file is the two static variables above, a finalization routine is in order. This should be a fairly trivial fix. I have attached a preliminary fix for these two issues (this is not a patch, it's just some code to cut and paste into tclDate.c/tclGetDate.y). I'm willing to learn yacc to assist if necessary. As a "next gen" solution to this problem, I suggested to dkf that we parse the dates using Tcl code that is evaluated when necessary (since yacc appears to be rather wild).
mistachkinplain2003-05-12 18:27:58
File Added - 50173: datefix.c
hobbsplain2003-05-14 06:03:07
Logged In: YES user_id=72656 No finalization is necessary because those two are statics, and I don't think anyone has ever changed that behavior. The point is that this is all yacc, and thus we have to work with what yacc gives us. It may be necessary to change the YYEXPAND, but I don't know of any problems that have arisen from this. The "leak" is a red herring because that is a never-used code path.
mistachkinplain2003-05-14 10:15:44
Logged In: YES user_id=113501 I already have some code that will fix these problems. Does anybody have a test case I can use to test it with (something that forces it to call malloc/realloc)? Also, what version of yacc is required and what is the proper invocation of the command to process tclGetDate.y ?
kennykbplain2003-05-19 02:40:11
Logged In: YES user_id=99768 Original poster confirms that the memory leak is resolved.
Log in (anonymous is fine) to add a comment.
Attachments:
- datefix.c [download] added by mistachkin on 2003-05-12 18:27:58. [details]