OSSP CVS Repository

ossp - Ticket #171
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Attach]  [Edit]  [History

Ticket 171: out of memory - large data loading via readline(); with spidermonkey

Hello, I'm very new to use spidermonkey, and trying to make a CGI to get large binary data (sound, video, and more) via a Web Form as thats enctype is "multipart/form-data". I wrote a script and tryed to get form-data. Its list is as below;

  var length = environment.CONTENT_LENGTH;
  var data = '';
  while ( data.length < length ){
    data += readline(); + "\n";
  }
  ...

but the script was died when its loaded a data of 1.2MB... I found a line 'out of memory' in httpd's error_log.

I've written a perl script for same purpose, ( read(STDIN, $data, $ENV{'CONTENT_LENGTH'}); ~ etc.) it worked well with a data of 700MB or more. Why didn't my spidermonkey script work well?

Please give your advise, I wish. Sorry for my poor English.

I tested with a server installed FreeBSD 7.2-PRERELEASE, CPU: Intel(R) Celeron(R) CPU 1.70GHz real memory = 662568960 (631 MB) avail memory = 638652416 (609 MB) HTTPD is Apache/2.2.11

[Append remarks]

Remarks:

I found a static propertie 'input' of File object for stdin. It work better than readline();. I'll pay my effort to complete my script.
[Append remarks]

Properties:

Type: event           Version: 1.6.20070208 
Status: closed          Created: 2009-Mar-27 03:48
Severity:          Last Change: 2009-Apr-02 14:40
Priority:          Subsystem:  
Assigned To: rse           Derived From:  
Creator: anonymous 

CVSTrac 2.0.1