Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt Malloc / Free over-riding
QtWS25 Last Chance

Qt Malloc / Free over-riding

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 3 Posters 7.3k Views
  • 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
    nvharisha
    wrote on last edited by
    #1

    We are having Qt4.8.2 working on Mips based Platform.
    For our requirement, we would like to use our own malloc/new and free/delete and not from standard library.
    In the above scenario, I can over-ride the new/delete operator easily. For malloc/free, LD_PRELOAD can be used for custom malloc/free.

    My question is - does Qt provides a any way to "over-ride" malloc/free? OR any other better way, compared to as described above?

    Hari

    1 Reply Last reply
    0
    • T Offline
      T Offline
      twsimpson
      wrote on last edited by
      #2

      Qt doesn't directly provide an ability to override symbols, as that's not really in the scope of Qt. It's something the linker needs to take care of (in terms of malloc/free), and Qt has no control over the linker.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shanek
        wrote on last edited by
        #3

        Qt's containers use qMalloc / qFree / qRealloc which are wrappers around the standard library functions.
        You can replace qmalloc.cpp in the QtCore library to use a different allocator.

        That won't help for c++ new / delete which are used directly.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved