Categories > TinyButStrong general >

Fatal memory error

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Whitlark
Date: 2005-05-13
Time: 20:58

Fatal memory error

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2635931 bytes) in /var/www/html/dev2/lib/common/tbs_class.php on line 1111

Unfortunately my client wants to see a list of 5000+ db entries on the same page.  I am calling a script to display this information. So tbs croaks because it stores the result of the script in memory before displaying it.  I doubt there is a way around this, but do you have any ideas?
By: Skrol29
Date: 2005-05-15
Time: 23:09

Re: Fatal memory error

Hi Whitlark,

A Show on the fly feature is still in study for TBS.
But you can walkaround your problem by incrising the allowed memory:
   ini_set("memory_limit",'16M');
By: RwD
Date: 2005-05-20
Time: 13:18

Re: Fatal memory error

Also you could make an header template, footer template and db entries template.

First Show() the header, then Show() the entries in bits you can handle, then Show() the footer.

The method stinks, but it should work.
----

So Skrol29, I see no good way of flushing everything that is processed. Doesn't that imply you are going to have to guess what variables contain allready finished values??

Could you perhaps not make tbs use temporary files to work on instead? Will be time consuming, but only as an option. I think the memoryproblem is solved then. But I do not know at what costs this will be....
By: Skrol29
Date: 2005-05-20
Time: 22:33

Re: Fatal memory error

> So Skrol29, I see no good way of flushing everything that is processed.
> Doesn't that imply you are going to have to guess what variables
> contain allready finished values??

In fact, I did code a OnTheFly property for TBS 2.0.2, but I took it off when I realized that several small outputs are much more slower that a single big output. But in the case of Whitlark, it could be intersting.

The method I used consisted in enhancing the MergeBlock() Method. When OnTheFly property is set to true and MergeBlock() is called, then TBS begins to output the part of the template before the block (merging Var fields), then TBS merges and output sections. This method assumes that  you cannot use Var fields and [onshow] blocks inside a block to merge.