Closed GoogleCodeExporter closed 8 years ago
I was unable to reproduce this issue using just "int 123;" as the program. What
program were you using?
Original comment by zik.sale...@gmail.com
on 1 Sep 2012 at 6:46
Hi! Sorry for the (very) late response! Here is the code fragment used:
#define PICOC_STACK_SIZE (128*1024) /* space for the the stack */
int main(int argc, char **argv)
{
int ParamCount = 1;
int DontRunMain = FALSE;
int StackSize = getenv("STACKSIZE") ? atoi(getenv("STACKSIZE")) : PICOC_STACK_SIZE;
if (argc < 2)
{
printf("Format: picoc <csource1.c>... [- <arg1>...] : run a program (calls main() to start it)\n"
" picoc -s <csource1.c>... [- <arg1>...] : script mode - runs the program without calling main()\n"
" picoc -i : interactive mode\n");
exit(1);
}
PicocInitialise(StackSize);
if (strcmp(argv[ParamCount], "-s") == 0 || strcmp(argv[ParamCount], "-m") == 0)
{
DontRunMain = TRUE;
PicocIncludeAllSystemHeaders();
ParamCount++;
}
if (argc > ParamCount && strcmp(argv[ParamCount], "-i") == 0)
{
PicocIncludeAllSystemHeaders();
PicocParseInteractive(TRUE);
}
else if( argc > ParamCount && strcmp(argv[ParamCount], "-z") == 0)
{
if (PicocPlatformSetExitPoint())
{
PicocCleanup();
printf( "Error!\n");
_CrtDumpMemoryLeaks();
return PicocExitValue;
}
#define CODE1 "int 123;"
PicocIncludeAllSystemHeaders();
printf( "z-option\n");
PicocParse( "filename3.c", CODE1, sizeof( CODE2), TRUE, TRUE, FALSE, FALSE);
}
else
{
...
}
PicocCleanup();
_CrtDumpMemoryLeaks();
return PicocExitValue;
}
I get this output on the console:
z-option
int 123;
^
filename3.c:1: identifier expected
Error!
Press any key to continue . . .
And this output from VC:
'picoc2010.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
Detected memory leaks!
Dumping objects ->
{1061} normal block at 0x00866E60, 9 bytes long.
Data: <6 1 {2 ] > 36 00 31 04 7B 32 08 5D 09
Object dump complete.
The program '[4296] picoc2010.exe: Native' has exited with code 1 (0x1).
Original comment by jjohans...@gmail.com
on 20 Dec 2012 at 9:55
Sorry, when pasting in the code above I made a mistake. Should look like this:
...
#define CODE2 "int 123;"
PicocIncludeAllSystemHeaders();
printf( "z-option\n");
PicocParse( "filename3.c", CODE2, sizeof( CODE2), TRUE, TRUE, FALSE, FALSE);
...
Original comment by jjohans...@gmail.com
on 20 Dec 2012 at 9:59
In the Lex.c source file, change the following function. It should fix the
memory leak!
/* deallocate */
void LexCleanup(Picoc *pc)
{
LexInteractiveClear(pc, NULL);
int Count;
for (Count = 0; Count < sizeof(ReservedWords) / sizeof(struct ReservedWord); Count++)
TableDelete(pc, &pc->ReservedWordTable, TableStrRegister(pc, ReservedWords[Count].Word));
}
Original comment by mmass...@gmail.com
on 23 Feb 2013 at 4:43
Fixed in r585. Thanks.
Original comment by zik.sale...@gmail.com
on 23 Feb 2013 at 10:57
Original issue reported on code.google.com by
jjohans...@gmail.com
on 20 Oct 2011 at 9:24