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. ATL / WTL / STL
  4. Memory allocation problem in C++ (memory Leak)

Memory allocation problem in C++ (memory Leak)

Scheduled Pinned Locked Moved ATL / WTL / STL
helpc++data-structuresperformance
2 Posts 2 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.
  • N Offline
    N Offline
    Nab Younus
    wrote on last edited by
    #1

    I am using Visual C (win32 Console Application) for feature extraction program. In my project I am extracting features from the trained images. Features aren in form of structures. Strcuture has 4 DOUBLE data items and 1 INT array of size 128. So this means one feature from the image. On average one image may generate from 500-1000 features. I am using dynamic memory allocation to store the structures for every trained image. I am using 800 images for training. This means huge amount of memory will be consumed to keep these features iN RAM. Now problem is that after training of 740 images I am getting error of memory leak i.e. insufficient memory to allocate. I have tried every possible way to avoid it but can't. So please tell me how i can overcome this issue. I will be really grateful.

    A 1 Reply Last reply
    0
    • N Nab Younus

      I am using Visual C (win32 Console Application) for feature extraction program. In my project I am extracting features from the trained images. Features aren in form of structures. Strcuture has 4 DOUBLE data items and 1 INT array of size 128. So this means one feature from the image. On average one image may generate from 500-1000 features. I am using dynamic memory allocation to store the structures for every trained image. I am using 800 images for training. This means huge amount of memory will be consumed to keep these features iN RAM. Now problem is that after training of 740 images I am getting error of memory leak i.e. insufficient memory to allocate. I have tried every possible way to avoid it but can't. So please tell me how i can overcome this issue. I will be really grateful.

      A Offline
      A Offline
      Anand Todkar
      wrote on last edited by
      #2

      Maximum of 2GB memory can be given to a process at a time (in 32-bit OS), once it goes beyond that limit, the program will not work. Now first check if you want all these 800 immages to be in memory at a time, if no then see that you are freeing up the unnecesssary memory. If you are facing difficulty in tracing that you are freeing up the memory correctly or not then you can use any memory leak detection tool to verify that. One of popular freeware is LeakDiag. Hope this will help you. :)

      Thanks, Anand.

      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