Click here to Skip to main content
12,748,873 members (38,961 online)
Click here to Skip to main content

Stats

25.2K views
215 downloads
43 bookmarked
Posted 16 Jun 2009

Session of low-level optimization of memory usage in C++ programs with total exposure

, , 22 Jun 2009 CPOL
In this article, we will try to make our algorithms work faster using the methods of low-level optimization of memory allocation in C++.
#ifndef CMN_TLS_BASED_ARENA_H
#define CMN_TLS_BASED_ARENA_H

#include "windows.h"
#include "exception"
#include "cmnArena.h"

#include "cmnArenaWin32.h"

namespace utils
{

class CTlsArenaProvider;

class CTlsArenaContext:public IArenaContext
{
    CTlsArenaProvider * m_pProvider;
public:
    CTlsArenaContext(CTlsArenaProvider * pProvider);
    // arena api
    virtual IArena * GetArena()const;
    virtual void SetArena(IArena * pArena);
};


class CTlsArenaProvider:public IArenaProvider
{
    DWORD m_dwTLS_index;
    
    CTlsArenaProvider(const CTlsArenaProvider&);
    CTlsArenaProvider&operator = (const CTlsArenaProvider&);

public:
    CTlsArenaProvider();
    ~CTlsArenaProvider();

    // item api
    virtual void QueryThreadAssociatedItem(ArenaContext_type * pContext);

    // tls based api
    IArena * GetArena()const;
    void SetArena(IArena * pArena);
};


} // utils
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Authors

No Biography provided

Apriorit Inc
Apriorit Inc.
Hungary Hungary
ApriorIT is a Software Research and Development company that works in advanced knowledge-intensive scopes.

Company offers integrated research&development services for the software projects in such directions as Corporate Security, Remote Control, Mobile Development, Embedded Systems, Virtualization, Drivers and others.

Official site http://www.apriorit.com
Group type: Organisation

32 members


You may also be interested in...

Pro
Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170215.1 | Last Updated 23 Jun 2009
Article Copyright 2009 by Victor A. Milokum, Apriorit Inc
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid