Exforsys
+ Reply to Thread
Results 1 to 3 of 3

How to Carry out Implementation

This is a discussion on How to Carry out Implementation within the C and C++ forums, part of the Programming Talk category; I want to know how one can carry out Memory pool implementation using C++ programming language. Also let me know ...

  1. #1
    rachelle is offline Member Array
    Join Date
    Apr 2006
    Answers
    97

    Question How to Carry out Implementation

    I want to know how one can carry out Memory pool implementation using C++ programming language. Also let me know how to access the allocated memory pool using C++ programming language. If someone idea is provided in this line I would try the same and envisage my knowledge in this regard.


  2. #2
    norman is offline Member Array
    Join Date
    May 2006
    Answers
    43
    You can use the following statement to allocate memory

    MemPoolHandle allocateMemory(size_t bytes);

    If you are creating a simple memory pool it would surely allocate three pools during compile time and the block size allocated for each depends on the application.


  3. #3
    Sandhya.Kishannag is offline Member Array
    Join Date
    Feb 2012
    Answers
    66
    A simple memory pool module can allocate, for example, 3 pools at compile time with block sizes optimized for the application which depends on the module. The application can allocate, access and free memory with the following interface:

    > Allocate memory from the pools. The function will determine the pool where the required block fits in. If all blocks of that pool are already reserved, the function tries to find one in the next bigger pool(s). An allocated memory block is represented with a handle.
    > The handle can for example be implemented with an unsigned int. The module can interpret the handle internally by dividing it into pool index, memory block index and a version. The pool and memory block index allow fast access, while the version, is incremented at each new allocation.
    >Get an access pointer to the allocated memory.
    > Free the formerly allocated memory block.


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...