Page 90 - DCAP408_WEB_PROGRAMMING
P. 90

Windows Programming




                    Notes              /*  Allocate  single  block  */
                                       Block  =  stFixedMemAlloc(MemoryPool);
                                       if(!Block)
                                     {
                                           printf(“Failure  during  memory  block  allocation.\n”);
                                       return 0;
                                     }


                                     /*  ... */


                                       /*  Free  memory  block  */
                                       stFixedMemFree(MemoryPool,  Block);


                                     /*  ... */


                                       /*  Deinitialization  */
                                       arDeinit();


                                       return  0;
                                   }
                                   5.3.1 Fixed Size Memory Management Configuration


                                   ST_USE_FIXMEM definition

                                   The  ST_USE_FIXMEM  constant  comprises information  whether  functions  for fixed  size
                                   memory blocks allocation are incorporated  or expelled from compilation.  Functions will be
                                   compiled if the constant value is fixed for 1 and will not be compiled if the constant value is fixed
                                   for 0.
                                   When this constant value is not defined, the value will be 1, by default. It will cause the addition
                                   of  functions  into  output  code.  If  the  fixed  size  memory  management  functions  are  not
                                   utilized,  it can be expelled  from compilation by setting  ST_USE_FIXMEM for  0 to decrease
                                   output code.
                                   Functions
                                   stFixedMemAlloc function
                                   Declaration:
                                   PVOID  stFixedMemAlloc(
                                       PVOID  MemoryPool
                                   );
                                   Parameters:

                                   MemoryPool





          84                                LOVELY PROFESSIONAL UNIVERSITY
   85   86   87   88   89   90   91   92   93   94   95