Link to home
Start Free TrialLog in
Avatar of gmartins77
gmartins77

asked on

problem with locate method

Hello.
I'm having memory problems when using the locate method. I'm using an
IBTable(Interbase). I've also tried with IBDataSet. The problem is the same.
The strange thing is that it depends on the tables I use...
When I do the following code:

FrmDados.Tabela_Amostra.active:=TRUE;
existe:=FrmDados.Tabela_Amostra.locate('chave_carta_fk;num_amostra',VarArray
Of([car.chave_carta,namo]),[]);

the memory allocated increases a lot (sometimes 3 times more; I'm checking
the memory with GetHeapStatus.TotalAllocated).
But when I run this code:

FrmDados.Tabela_Pesagem.active:=TRUE;
existe:=FrmDados.Tabela_pesagem.locate('chave_amostra_fk;n',VarArrayOf([chav
e_a,pes.N]),[]);

the memory sometimes decreases!!!! The tables are not the same, but the
second table has more records than the first!
Can anyone give me some tips on how to avoid this memory problem?
Thanks

Goncalo

ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you do not want a query,
then supply the table with indexes on the to locate fields

meikl ;-)
A locate should be that last thing to be used in order not to increase the memory usage!
U should also take a look at IBSQL component in order to execute a query with a minimum overhead!

Espero q tenha ajudado! (Vi o português no nome das suas tabelas).

VSF
www.victory.hpg.com.br
www.boatoda.hpg.com.br
www.enge.cjb.net
 
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pnh73
pnh73

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split between kretzschmar and dMa

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer