Drupal 6.6 memory exhaustion when editing pages with many attachments
I have upgraded my web site from Drupal 5.x to Drupal 6.6. On my web server, PHP is allowed to use 32 MB of RAM.
Before the upgrade, I could edit pages with lots of attachments without any trouble (383 attachments is that maximum I have on a single page).
Since the upgrade, I cannot edit these pages anymore because I get "PHP Fatal error: Out of memory" messages.
On pages with the most files, I get this message when I click "Edit" on a page. On pages with intermediate number of files, I can view the edit form but when I click "Preview" I get the same error.
It only works fine for pages with less than approximately 80 files.
Viewing the pages never causes any trouble, even the one with 383 files.
I can reproduce this issue even after disabling all contributed modules so I'm pretty sure it's an issue in drupal core itself.
I know you will tell me to allow php to use more memory like 64 MB to fix this problem, but I cannot do that because my site is on free shared hosting.
I would like to understand what has changed from drupal 5.x to 6.x that causes so much memory to be used? And why does it only impact edit and not view?
How can I investigate to find which core module/variable/structure is using too much memory compared to drupal 5.x?
Do you have any suggestion to work around this issue? I'm now stuck with some pages that I cannot edit anymore...

please specify usecase
could you please specify a usecase for so many attatchments, as it seems to be an edge-case.
I'd like to see some details
I'd like to see some details of the use case as well-- i'm having trouble visualizing a need for >300 file attachments on one page. Are you using it to store file downloads? Are you using js/jquery to handle presenting all that info?
Seems to me this is probably something better off done with views.
===
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime." - Lao Tzu
"God helps those who help themselves." - Ben Franklin
"Search is your best friend." - Worldfallz
I can't answer the question
I can't answer the question which processes consume more memory than others on any particular page load (edit vs view), but generally a typical Drupal 6 core-only installation requires 16M whereas Drupal 5 required 8M (see http://drupal.org/requirements).
It is possible that the particular way you have things set up takes up more than 32M in D6. You may need to go back to D5 if you have a database backup and you need to stay on that server, or you could try experimenting with breaking up pages.
The http://drupal.org/project/devel module may give you some info about memory consumption on each page, at least for some sample pages where it won't cause running out of memory even faster.
Modify the .htaccess file
You can modify the .htaccess file at the root of your Drupal install and add a "php_value memory_limit 64M" line. The .htaccess will let you override the default php.ini values.
If your free hosting provider does not let you use .htaccess files, then you should consider moving to cheep hosting services.
Drupal 6.6 definitely need more memory and 64M is the minimum I recommend.