General Help regarding HMG, Compilation, Linking, Samples
Moderator: Rathinagiri
AUGE_OHR
Posts: 2117 Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Post
by AUGE_OHR » Tue Nov 30, 2021 11:09 am
hi,
i have try to load a "big" File into EDITBOX which work.
but when release Form it seems not to release EDITBOX / VALUE
Code: Select all
cMemo := HB_MEMOREAD( cFile )
DEFINE WINDOW TXTEdit ;
ON RELEASE TXTRelease( lEdit, cFile ) ;
DEFINE EDITBOX TXTCtrl
VALUE cMemo
ACTIVATE WINDOW TXTEdit
cMemo := " "
RETURN
Code: Select all
STATIC PROCEDURE TXTRelease( lEdit, cFile )
IF lEdit = .T.
IF lChanged = .T.
IF msgyesno( "Save Change ?", "TXT have change" ) == .T.
hb_MemoWrit( cFile, TXTEdit.TXTCtrl.Value )
ENDIF
ENDIF
ENDIF
TXTEdit.TXTCtrl.Value := " "
RETURN
what can i do
have fun
Jimmy
edk
Posts: 999 Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Post
by edk » Tue Nov 30, 2021 11:13 am
Release Memory or EmptyWorkingSet()
AUGE_OHR
Posts: 2117 Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Post
by AUGE_OHR » Tue Nov 30, 2021 11:42 am
hi
forgot to say : all LOCAL
edk wrote: ↑ Tue Nov 30, 2021 11:13 am
Release Memory or EmptyWorkingSet()
"where" to use "Release Memory" ?
how to use EmptyWorkingSet( [ ProcessID ] ) ---> lBoolean ?
thx for help
have fun
Jimmy
edk
Posts: 999 Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Post
by edk » Tue Nov 30, 2021 1:57 pm
Maybe try:
Code: Select all
ACTIVATE WINDOW TXTEdit
EmptyWorkingSet()
srvet_claudio
Posts: 2224 Joined: Thu Feb 25, 2010 8:43 pm
Location: Uruguay
Contact:
Post
by srvet_claudio » Tue Nov 30, 2021 3:53 pm
Hi,
for example:
TXTEdit.TXTCtrl.Value := " "
RELEASE MEMORY // this call Harbour garbage collect
edk
Posts: 999 Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Post
by edk » Tue Nov 30, 2021 8:44 pm
srvet_claudio wrote: ↑ Tue Nov 30, 2021 3:53 pm
Hi,
for example:
TXTEdit.TXTCtrl.Value := " "
RELEASE MEMORY // this call Harbour garbage collect
Dear Claudio.
Unfortunately, this does not free up memory, at least all "consumed" while creating Editbox.
See my demo.
demo.zip
(1.71 KiB) Downloaded 107 times
An application without a 100 MB file loaded in Editbox has approximately 1930 MB of free resources. After loading the file, the memory is reduced by 400 MB, and after releasing Editbox and "Release Memory", only 100 MB is released, still 300 MB is occupied. Each subsequent loading of a 100 MB file takes up the next 400 MB of memory.
edk
Posts: 999 Joined: Thu Oct 16, 2014 11:35 am
Location: Poland
Post
by edk » Wed Dec 01, 2021 1:12 pm
It seems to me that the problem is UNICODE, if I convert HMG to ANSI the problem does not occur (memory is released in the same amount as allocated memory). I guess it has something to do with HMG_WCHAR_TO_CHAR (c) and for some reason the allocated memory is doubled and then not released
Unfortunately, my knowledge of C is insufficient to solve this issue