C# WinForms: Memory Usage on multi lingual app

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dantz
    New Member
    • Oct 2008
    • 71

    C# WinForms: Memory Usage on multi lingual app

    Hi everyone,

    I will be supporting 5 languages in my app.
    And I'm not sure if my memory usage will increase a lot if I put all the image resources inside the resource file.

    Currently the images are 25MB / language
    My memory usage is 600MB currently.

    Will it consume more memory when i put in all resources in the resource file?


    Thanks in advance.


    -dantz
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Your *memory* usage is 600mb? That's more than Adobe Photoshop.
    What the frak is the application for?
    A 2gig machine with 1.3 for the O.S. will barely be able to run it.

    You could do language specific resource files so that when your installer runs for that language then you get just those resources.

    If you built a form in one language (default/English), then changed the language in designer (say to German), then imported your graphics, it should have happened automatically. I've only done a couple applications like this (English, Spanish) but it was pretty painless once I got the 'feel' of it.

    Comment

    • dantz
      New Member
      • Oct 2008
      • 71

      #3
      The memory is roughly around this size 400-600mb...
      It is a game manager that handles flash games
      Inside the game manager got 10 picturbox that have timer to do animation by changing images. 1 of the picturebox change images every 50ms interval of the timer, while others are using 100ms interval.

      For changing of language, the trigger will be during run-time.
      I have something like a system menu where the user can choose 2 language between the 5 available languages. Then when he finish choosing the languages it will be reflected on the main form where there is a button to change between the 2 language.

      How am I suppose to support these kind of feature without increasing my memory usage?

      Another question is it possible to make the supporting without changing the code?/ I mean if i add one more language from the present 5 is it possible to do it by not changing any source code?

      TIA

      -dantz

      Comment

      • vishal1082
        New Member
        • Apr 2009
        • 92

        #4
        i made a application like that, i used XML's with text in different languages, but i dont understand, you are using images instead of text and want to.. "translate" text in images? if thats the way then as tlhintoq said just make different resource files with images in different languages and then use the resource file according to language (the same way i did with XML's -- was easy)

        Comment

        • tlhintoq
          Recognized Expert Specialist
          • Mar 2008
          • 3532

          #5
          Vishal: Nobody said anything about translating text to images, except you.

          Datz: You could change the design from having everything in memory/resources to having your images in directories within the application directory. Then change languages based on what directories exist. To add a language you just add a subdirectory with your images and maybe a file of all the text used in messages.

          Comment

          • vishal1082
            New Member
            • Apr 2009
            • 92

            #6
            but i dont understand, you are using images instead of text and want to.. "translate" text in images?
            i said that, i didnt *understand* what he exactly wanted to do.. it was a guess sheesh..

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              What I don't understand is why having multiple resources for different languages is going to affect your memory anyways??

              When you're using an application you just want it to be displayed in the language/culture that you are comfortable with. You don't really care about the other languages/cultures.

              Resource files make this possible. Only the resources required for the application in the user's language/culture is used (unless the resource can't be found in that language/culture in which case it falls back to the default language/cultural resource). It doesn't make sense to load 5 resource files when the user is only interested in viewing the application in their language/culture.

              The resource files may take up space on the hard drive but I wouldn't have thought that they effect memory...?

              If you're unfamiliar with resources in .NET check out Resources in Applications, Resources in .resx file format, Creating Resource Files, Packaging and deploying resources, and Satellite Assemblies...

              -Frinny

              Comment

              • tlhintoq
                Recognized Expert Specialist
                • Mar 2008
                • 3532

                #8
                For changing of language, the trigger will be during run-time.
                I have something like a system menu where the user can choose 2 language between the 5 available languages.
                To me I think the OP is creating a language training game. Pick English and Spanish to learn a new language. Pick Gernan and French. Etc. Which would explain why he has to load so much data and not just a single language installation.

                Dantz: Am I guessing correctly?

                Comment

                • dantz
                  New Member
                  • Oct 2008
                  • 71

                  #9
                  Thanks for all the replies

                  To me I think the OP is creating a language training game. Pick English and Spanish to learn a new language. Pick Gernan and French. Etc. Which would explain why he has to load so much data and not just a single language installation.
                  tlhintoq: Nope it is not a training game. The reason for supporting 2 language is to let users choose which language they are comfortable with.
                  (I am just actually following a user requirement. If I will be deciding on the language I will just use the local language where my application will be shipped)

                  Comment

                  • dantz
                    New Member
                    • Oct 2008
                    • 71

                    #10
                    ...but i dont understand, you are using images instead of text
                    vishal1082: I am using images because the display for Chinese and Japanese text doesn't look nice..That was my solution to deal with those double byte characters because the UI must look really nice (~even though i know resources file size will suffer)

                    Comment

                    • dantz
                      New Member
                      • Oct 2008
                      • 71

                      #11
                      What I don't understand is why having multiple resources for different languages is going to affect your memory anyways??
                      Frinavale: I am just guessing. Because right now my application is already having a big memory consumption. So I am not sure if this is a cause of the way I am using images through timer or because of all the objects that are persistent since my app loaded. As of now if I redesign my application there isn't much enough time to do it, So now what I am doing is atleast trying not to extend more on that memory usage.

                      Comment

                      • dantz
                        New Member
                        • Oct 2008
                        • 71

                        #12
                        Datz: You could change the design from having everything in memory/resources to having your images in directories within the application directory. Then change languages based on what directories exist. To add a language you just add a subdirectory with your images and maybe a file of all the text used in messages.
                        tlhintoq: Thanks for this suggestion. Is the loading from file and loading from .resx have any differences? Because at start I was adding the images in an outside directory but there is one instance that when I load a form while loading its image contents from file (keyboard kind of form), I had seen some flickering before the form shows completely. Then each keys in that form are somewhat showing one by one (that somehow looks like I am animating it)

                        Comment

                        • tlhintoq
                          Recognized Expert Specialist
                          • Mar 2008
                          • 3532

                          #13
                          tlhintoq: Nope it is not a training game. The reason for supporting 2 language is to let users choose which language they are comfortable with.
                          In that case the installer should offer the language choice to the user when the application is installed, just a like any other application. You don't really have multiple resource files INSTALLED and MEMORY RESIDENT when it is running.

                          Comment

                          • tlhintoq
                            Recognized Expert Specialist
                            • Mar 2008
                            • 3532

                            #14
                            I was adding the images in an outside directory but there is one instance that when I load a form while loading its image contents from file (keyboard kind of form), I had seen some flickering before the form shows completely. Then each keys in that form are somewhat showing one by one (that somehow looks like I am animating it)
                            Then don't show the form until all the images have loaded. Create it, load the images, then show it.

                            Also, how big are your keycap images? I have a hard time imaging the loading of 102 images (standard keyboard) to be so slow that you can watch them appear one by one - provided the images are of the same size as the keys.

                            Comment

                            • dantz
                              New Member
                              • Oct 2008
                              • 71

                              #15
                              Also, how big are your keycap images?
                              Its 6kb each..having 100x100 dimension.

                              Hmm..maybe i need to try it one more time. There is probably some other cause why it resulted to be like that. Showing the form in modal doesn't have any effect right?

                              Comment

                              Working...