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. How to catch out of memory allocation in C?

How to catch out of memory allocation in C?

Scheduled Pinned Locked Moved C / C++ / MFC
c++performancetutorialquestion
5 Posts 4 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.
  • G Offline
    G Offline
    Gofur Halmurat
    wrote on last edited by
    #1

    Hello everybody, Does anyone know how to catch out of memory allocation in C/C++? Thanks in advance

    It is never late to learn

    S M 2 Replies Last reply
    0
    • G Gofur Halmurat

      Hello everybody, Does anyone know how to catch out of memory allocation in C/C++? Thanks in advance

      It is never late to learn

      S Offline
      S Offline
      Saurabh Garg
      wrote on last edited by
      #2

      Simply check the reutned pointer for NULL. If it is null the memory was not allocated. -Saurabh

      1 Reply Last reply
      0
      • G Gofur Halmurat

        Hello everybody, Does anyone know how to catch out of memory allocation in C/C++? Thanks in advance

        It is never late to learn

        M Offline
        M Offline
        Mark Salsbery
        wrote on last edited by
        #3

        That really depends on HOW you're allocating the memory. Throw us a bone here :) Mark

        CPalliniC 1 Reply Last reply
        0
        • M Mark Salsbery

          That really depends on HOW you're allocating the memory. Throw us a bone here :) Mark

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          :-D

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          In testa che avete, signor di Ceprano?

          M 1 Reply Last reply
          0
          • CPalliniC CPallini

            :-D

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            *woof!*

            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