Results 1 to 4 of 4

Thread: Form Translate: memory waste

  1. #1
    MozartFazito is offline Junior Member
    Join Date
    Nov 2008
    Location
    Belo Horizonte, MG - Brazil
    Posts
    2

    Default Form Translate: memory waste

    I'm testing internationalization in Zend Form with .tmx file. It works fine, but the created form object isn't optimized. All the messages and expressions in the .tmx file are repeated 11 times in a form with 2 fields and 2 buttons. This wasting of memory is unacceptable in production environment.

    Is there any solution that puts the translation table only once in the computer memory?

  2. #2
    thomas is offline Senior Member
    Join Date
    Aug 2008
    Posts
    174

    Default

    The translation table is ONCE in the memory. Within Zend_Translate !

    I don't know what you are expecting, but Zend_Translate translates your input, and Zend_Form creates a form... this two components are not related to each other.

    Also why should Zend_Form hold an translation table ?

    I would be interested in how you measured that there is 11 times more memory consumtion than without Zend_Form.
    Greetings
    Thomas Weidner
    I18N Team Leader, Zend Framework
    http://www.thomasweidner.com

  3. #3
    MozartFazito is offline Junior Member
    Join Date
    Nov 2008
    Location
    Belo Horizonte, MG - Brazil
    Posts
    2

    Default I may be wrong, but I'd like to know where.

    I printed out the form object (with print_r) and all the messages appeared 11 times in the print.

  4. #4
    thomas is offline Senior Member
    Join Date
    Aug 2008
    Posts
    174

    Default

    Sorry, but this is no professional approach.

    Only because a object is referred multiple times within another object does not mean that it uses also multiple times the memory.

    You are simply accessing the same memory multiple times due to your print_r call which forces each object to be rendered as string. Still it is one Zend_Translate object which holds the information.

    A object reference uses about 2 bytes... I don't think that 11x2bytes are a big problem in eighter environment.
    Greetings
    Thomas Weidner
    I18N Team Leader, Zend Framework
    http://www.thomasweidner.com

Similar Threads

  1. translate each expression according his html id
    By Yosef in forum General Q&A on Zend Framework
    Replies: 0
    Last Post: 07-08-2010, 12:37 PM
  2. Replies: 6
    Last Post: 03-31-2009, 07:15 AM
  3. $translate->isAvailable() always true?
    By PoolSnoopy in forum Internationalization (i18n) & Localization (l10n)
    Replies: 2
    Last Post: 03-29-2009, 07:28 AM
  4. out of memory?
    By tixrus in forum General Q&A on Zend Framework
    Replies: 0
    Last Post: 01-16-2009, 06:23 PM
  5. Zend Form translate error messages
    By bigman007 in forum Internationalization (i18n) & Localization (l10n)
    Replies: 1
    Last Post: 08-18-2008, 07:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •