Ticket UUID: | 736425 | |||
Title: | memory leaks in tclDate.c | |||
Type: | Bug | Version: | None | |
Submitter: | mistachkin | Created on: | 2003-05-12 11:27:58 | |
Subsystem: | 06. Time Measurement | Assigned To: | kennykb | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2003-05-19 02:40:11 | |
Resolution: | Fixed | Closed By: | kennykb | |
Closed on: | 2003-05-18 19:40:11 | |||
Description: |
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). | |||
User Comments: |
kennykb added on 2003-05-19 02:40:11:
Logged In: YES user_id=99768 Original poster confirms that the memory leak is resolved. mistachkin added on 2003-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 ? hobbs added on 2003-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. mistachkin added on 2003-05-12 18:27:58: File Added - 50173: datefix.c |
Attachments:
- datefix.c [download] added by mistachkin on 2003-05-12 18:27:58. [details]