Bug 7681 - memory leak in the plug-in tests
Summary: memory leak in the plug-in tests
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Darin Adler
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-09 07:28 PST by Darin Adler
Modified: 2006-03-10 11:24 PST (History)
1 user (show)

See Also:


Attachments
patch with detailed change log (13.95 KB, patch)
2006-03-09 07:40 PST, Darin Adler
sullivan: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Adler 2006-03-09 07:28:09 PST
I noticed that the new plug-in tests are exhibiting leaks. The bug is in the test plug-in. I have a fix.
Comment 1 Darin Adler 2006-03-09 07:40:49 PST
Created attachment 6958 [details]
patch with detailed change log
Comment 2 Alexey Proskuryakov 2006-03-09 08:33:52 PST
> Changed code to put the strings in malloc buffers instead of relying on GCC's extension 
> that allows variable-sized arrays on the stack.

Didn't this use a standard C99 feature (although gcc variable-sized arrays aren't exactly the same as C99 ones)?
Comment 3 John Sullivan 2006-03-09 09:11:06 PST
Comment on attachment 6958 [details]
patch with detailed change log

Nice clean-up, r=me.
Comment 4 Darin Adler 2006-03-10 11:24:34 PST
(In reply to comment #2)
> Didn't this use a standard C99 feature (although gcc variable-sized arrays
> aren't exactly the same as C99 ones)?

There are good reasons to not use this in general, even though it's present in C99.

For one thing, we don't have a C99-compliant compiler on all the paltforms we target. For another, using a variable amount of stack can cause problems on OS X. Because of that, we generally don't use this technique in any production code. A test tool doesn't quite qualify as production code, of course.