|
프로그램의 메인 유닛에서..
void __fastcall TFORM_MAIN::MM_EntityTableClick(TObject *Sender)
{
Application->CreateForm(__classid(TFORM_ENTITY), &FORM_ENTITY);
FORM_ENTITY->Show();
}
이렇게 폼을 생성하구요..
불려진 폼 FORM_ENTITY에서는 특별히 생성한 것이 없는데요..
__fastcall TFORM_ENTITY::TFORM_ENTITY(TComponent* Owner)
: TForm(Owner)
{
TEdit *SmcEdit[MAX_SMC_EDIT-1];
TEdit *SmeEdit[MAX_SME_EDIT-1];
}
이렇게 배열선언한것 외에..
각 이벤트에서 사용하는 로컬변수,,,, 밖에 없는데요..(new 를 사용한것두 없구요..)
예를들어...
void TFORM_ENTITY::ShowSME()
{
char *pResult, *pItem;
char sme_id[16], sme_name[32], pid[8], pwd[24], platformid[24],format[16];
char action[24], host[24], trace[16], buffer[24], pool_cnt[8], pool_snd[8],desc[50];
char control[24], status[24];
int count = 0;
mode = SHOW_CMD;
StringGrid2->Rows[1]->Clear();
StringGrid2->RowCount = 2;
pResult = SendRequest(CMD_RET_SME, "");
if (*pResult == 0)
return;
InitItem(pResult);
while (*(pItem = NextItem()) != 0) {
if (*pItem == ERR_COMMAND) {
ShowMessage(pItem + 1);
return;
}
sscanf(pItem, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s",
sme_id, sme_name, pid, pwd, platformid, format, action, host,
trace, buffer, pool_cnt, pool_snd, control, status, desc);
StringGrid2->RowCount = count + 2;
StringGrid2->Cells[0][count+1] = sme_id;
StringGrid2->Cells[1][count+1] = sme_name;
StringGrid2->Cells[2][count+1] = pid;
StringGrid2->Cells[3][count+1] = pwd;
StringGrid2->Cells[4][count+1] = platformid;
StringGrid2->Cells[5][count+1] = format;
StringGrid2->Cells[6][count+1] = action;
StringGrid2->Cells[7][count+1] = host;
StringGrid2->Cells[8][count+1] = trace;
StringGrid2->Cells[9][count+1] = buffer;
StringGrid2->Cells[10][count+1] = pool_cnt;
StringGrid2->Cells[11][count+1] = pool_snd;
StringGrid2->Cells[12][count+1] = control;
StringGrid2->Cells[13][count+1] = status;
StringGrid2->Cells[14][count+1] = desc;
count++;
StringGrid2->RowHeights[StringGrid2->RowCount-1] = 15;
}
SMESelectItem(SHOW_CMD);
}
이 정도 인데..
그리고..
void __fastcall TFORM_ENTITY::bt_ExitClick(TObject *Sender)
{
Close();
}
void __fastcall TFORM_ENTITY::FormClose(TObject *Sender,
TCloseAction &Action)
{
Action = caFree;
}
이렇게 했는데... 작업관리자를 통해 메모리 사용량을 보니..
close();를 해도.. 메모리 사용량이 줄어들지 않더라구요.
혹시 모르니.. 생성되는 폼의 소스를 첨부하겠습니다.
특별히.. 메모리를 할당한 것이 .. 있는지 한번 봐주실래요?
홍성진 님이 쓰신 글 :
: 권선미 님이 쓰신 글 :
: : 밑의 메모리 문제에서.. Action = caFree를 OnClose이벤트에
: : 넣으면 된다고 하셨는데..
: : 그래두.. 메모리 사용량이 줄어들지 않네요..
: :
: : 메인테서 버튼을 누르면 CreateForm하구요..
: : 불려진 폼의 Onclose이벤트에서 Action = caFree라고 넣었는데...ㅠ.ㅠ
: : 안되서.. delete 폼이름.. 이렇게도 해봤는데.. 마찬가지네요..
: :
: : 무엇이 문제인가요?
: : ㅠ.ㅠ
: :
:
: 안녕하세요. 홍성진 입니다.
:
: 폼이 문제가 아니라면..
: 생성된 폼 안에서 다른 메모리 공간을 할당하고 해제하지 않았는지
: 확인해 보세요.
:
: 그리고, 폼 생성하는 부분의 코드를 한번 올려봐주세요.
: 답변 드리는데 많은 도움이 될 수 있습니다.
:
: 그럼.
|