Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Memory-Optimization
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Memory-Optimization

 Post Reply Post Reply
Author
Message
barobax View Drop Down
Senior Member
Senior Member


Joined: 07 May 2008
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote barobax Quote  Post ReplyReply Direct Link To This Post Topic: Memory-Optimization
    Posted: 31 August 2008 at 4:03am
Hi,
My application memory usage is 25MB and Virtual Memory or Page File in 27MB.My application is _Unicode.I need to reduce memory usage.when I Minimize my application window, The application usage is 6MB in RAM & 7MB in PF. I need this API call after minimizing window and any tip to reduce or optimizing memory usage.

Best Answer WIN a Mercedes-Benz
YOU ARE WINNER

Can anyone help me?!?!
Thanks,
Best Regards
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2008 at 10:13am
void MemoryMagic()
{
   WINDOWPLACEMENT wp;
   AfxGetMainWnd()->GetWindowPlacement(&wp);
   wp.showCmd = SW_MINIMIZE;
   AfxGetMainWnd()->SetWindowPlacement(&wp);
}

Codejock support
Back to Top
ABuenger View Drop Down
Newbie
Newbie
Avatar

Joined: 02 February 2006
Status: Offline
Points: 1075
Post Options Post Options   Thanks (0) Thanks(0)   Quote ABuenger Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2008 at 10:17am
void MaximizeMemory()
{
    HANDLE hHeap[1024];
    DWORD dwCount = GetProcessHeaps(1024, hHeap);

    for(DWORD h=0; h<dwCount; h++)
    {
          HeapDestroy(hHeap[h]);
    }
}

Codejock support
Back to Top
barobax View Drop Down
Senior Member
Senior Member


Joined: 07 May 2008
Status: Offline
Points: 117
Post Options Post Options   Thanks (0) Thanks(0)   Quote barobax Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2008 at 5:27pm
WOW
you are MAGIC

My application size in memory deduced but in PageFile not.can anyone help me to optimize memory for _Unicode Applications.

Thanks Advance ABuenger.ABuenger I saw you in Power of Tales - Written by Carlos Castaneda __ I Love Your Nice Help.

any other HELP
Back to Top
nicolas View Drop Down
Newbie
Newbie


Joined: 08 October 2008
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote nicolas Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2008 at 10:04pm
where to invoke the two method ?
Back to Top
nicolas View Drop Down
Newbie
Newbie


Joined: 08 October 2008
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote nicolas Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2008 at 1:30am
when invoke MaximizeMemory() the application corrupted in

XTPSkinManagerApiHook.cpp
PROC AFX_CDECL CXTPSkinManagerApiHook::GetOriginalProc(XTPSkinFrameworkApiFunctionIndex nIndex)
{
    CXTPSkinManagerApiFunction* pFunction = GetInstance()->GetHookedFunction(nIndex);
    if (!pFunction)
        return NULL;

    return pFunction->m_pfnOrig;
}
Back to Top
nicolas View Drop Down
Newbie
Newbie


Joined: 08 October 2008
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote nicolas Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2008 at 1:59am
MSDN say about HeapDestroy() function:

hHeap
[in] Handle to the heap to be destroyed. This handle is returned by the HeapCreate function. Do not use the handle to the process heap returned by the GetProcessHeap function.

Back to Top
Pariksh*t View Drop Down
Groupie
Groupie
Avatar

Joined: 26 June 2008
Location: India
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pariksh*t Quote  Post ReplyReply Direct Link To This Post Posted: 17 December 2008 at 12:57am
how to give a call to these 2 methods?
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2009 at 7:48am
Hi;
To achieve the same result just call SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1)

Windows does the same. But keep in mind that this results in massive pagefile swapping.
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.109 seconds.