Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Heap allocation from SDRAM

Heap allocation from SDRAM

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionperformance
9 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Toni78
    wrote on last edited by
    #1

    I know that this question is not really related to Visual C++ but hopefully there will be someone here who has experience in real-time programming. I'd like to allocate memory using malloc( ) function which allocates it on the internal SRAM. Does anyone know how I could do dynamic memory allocation on the SDRAM?

    Time is the fire in which we burn.

    T V 2 Replies Last reply
    0
    • T Toni78

      I know that this question is not really related to Visual C++ but hopefully there will be someone here who has experience in real-time programming. I'd like to allocate memory using malloc( ) function which allocates it on the internal SRAM. Does anyone know how I could do dynamic memory allocation on the SDRAM?

      Time is the fire in which we burn.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...


      TOXCCT >>> GEII power

      [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

      9 T Z 3 Replies Last reply
      0
      • T Toni78

        I know that this question is not really related to Visual C++ but hopefully there will be someone here who has experience in real-time programming. I'd like to allocate memory using malloc( ) function which allocates it on the internal SRAM. Does anyone know how I could do dynamic memory allocation on the SDRAM?

        Time is the fire in which we burn.

        V Offline
        V Offline
        Viorel
        wrote on last edited by
        #3

        If you need to avoid disk-swapping procedure during memory allocation, maybe this similar discussion -- http://groups.google.com/group/microsoft.public.win32.programmer.kernel/browse_thread/thread/13956625fae7694b/4eb6261aa7f8b1f0?lnk=raot[^] -- will give you some information, I hope.

        1 Reply Last reply
        0
        • T toxcct

          where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...


          TOXCCT >>> GEII power

          [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

          9 Offline
          9 Offline
          9ine
          wrote on last edited by
          #4

          ohhhhh! nice memory leaks :-) never clean it after yourself! is in C++ 'new' is a stub to call 'malloc'. by the way malloc is much faster than 'new' when called several hundred times.

          9ine

          T 1 Reply Last reply
          0
          • T toxcct

            where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...


            TOXCCT >>> GEII power

            [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

            T Offline
            T Offline
            Toni78
            wrote on last edited by
            #5

            toxcct wrote:

            where else do you think you can dynamically allocate some memory ?

            In multiple heap scenarios you can define your own memory segments to specify which area of memory is used to allocate various elements such as messages, semaphores etc. I have a feeling that this is processor dependend and not something that I can do with C standard functions. Is there a way of doing this without depending on the platform being used? I realize that my previous question is not clear enough and I apologize for that. I must stress that this is a Real-Time programming related question.

            Time is the fire in which we burn.

            R 1 Reply Last reply
            0
            • 9 9ine

              ohhhhh! nice memory leaks :-) never clean it after yourself! is in C++ 'new' is a stub to call 'malloc'. by the way malloc is much faster than 'new' when called several hundred times.

              9ine

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              9ine wrote:

              by the way malloc is much faster than 'new' when called several hundred times

              but non reentrant... so, bad !


              TOXCCT >>> GEII power

              [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

              1 Reply Last reply
              0
              • T toxcct

                where else do you think you can dynamically allocate some memory ? use malloc(), it will do the job for you, unless you use C++, then, use new instead. but never forget : when you dynamically allocate some memory, you have to free it yourself, otherwise you'll get into memory leaks hell...


                TOXCCT >>> GEII power

                [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                Z Offline
                Z Offline
                Zac Howland
                wrote on last edited by
                #7

                toxcct wrote:

                where else do you think you can dynamically allocate some memory ?

                In real-time/embedded systems, where you allocate memory is often just as important as the memory you actually allocate. I believe the OP is asking how he can allocate memory in SDRAM instead of SRAM. I think that is system dependent. I'm trying to remember my VxWorks stuff (haven't used it in a while) ... but I think you have to make a OS API call to allocate memory outside the default heap.

                If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                T 1 Reply Last reply
                0
                • Z Zac Howland

                  toxcct wrote:

                  where else do you think you can dynamically allocate some memory ?

                  In real-time/embedded systems, where you allocate memory is often just as important as the memory you actually allocate. I believe the OP is asking how he can allocate memory in SDRAM instead of SRAM. I think that is system dependent. I'm trying to remember my VxWorks stuff (haven't used it in a while) ... but I think you have to make a OS API call to allocate memory outside the default heap.

                  If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                  T Offline
                  T Offline
                  Toni78
                  wrote on last edited by
                  #8

                  Thank you so much Zac. That answers my question. :)

                  Time is the fire in which we burn.

                  1 Reply Last reply
                  0
                  • T Toni78

                    toxcct wrote:

                    where else do you think you can dynamically allocate some memory ?

                    In multiple heap scenarios you can define your own memory segments to specify which area of memory is used to allocate various elements such as messages, semaphores etc. I have a feeling that this is processor dependend and not something that I can do with C standard functions. Is there a way of doing this without depending on the platform being used? I realize that my previous question is not clear enough and I apologize for that. I must stress that this is a Real-Time programming related question.

                    Time is the fire in which we burn.

                    R Offline
                    R Offline
                    Rick York
                    wrote on last edited by
                    #9

                    That is platform dependent.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups