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. Managed C++/CLI
  4. Problem with pointers memory allocation on the same memory area

Problem with pointers memory allocation on the same memory area

Scheduled Pinned Locked Moved Managed C++/CLI
csswpfdebuggingjsonperformance
1 Posts 1 Posters 4 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.
  • M Offline
    M Offline
    Member 9595080
    wrote on last edited by
    #1

    Hello, We use a third party library for our grids. Each grid cell has a style, one member of which is the font:

    class CLibStyle
    {
    [...]
    CLibFont m_pFont;
    [...]
    };

    During serialization in the library methods, the font is managed as follows:

    ar >> m_pFont;

    For our part, we deserialize the styles line by line, column by column, then storing them in a map to use them later:

    CLibStyle * pStyle = NULL;
    for (int nNumRow = 0; nNumRow ++; nNumRow Serialize(ar);
    mapStyle->AddTail(pStyle);
    }

    So far it's very basic but this is where we have a big problem because it happens that this deserialization, as simple as it is, allocates pointers m_pFont on the same memory areas from one loop to another. With the same archive file, this problem does not necessarily arise depending on whether you are in Debug or in Release, or even differs from one PC to another. :~ Afterwards, we inevitably have problems even if the pointers are destroyed ... Any ideas for ensuring that pointers are not allocated on the same memory range?

    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