Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: UniDirectional


This question is answered.


Permlink Replies: 4 - Last Post: Mar 21, 2018 11:39 AM Last Post By: Jeff Overcash (... Threads: [ Previous | Next ]
Todor Geshev

Posts: 14
Registered: 10/1/00
UniDirectional  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2018 6:25 AM
Have TIBQuery with unidirectional=false.
If many times it open and closed by changing only the parameters or open once, but with many records in results it gives "Out of memory"
Thnaks
quinn wildman

Posts: 156
Registered: 4/20/07
Re: UniDirectional
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 20, 2018 8:21 AM   in response to: Todor Geshev in response to: Todor Geshev
If unidirectional is false, then every row you scroll through gets
loaded into memory and scrolling through a large result set is expected
to eventually result in out memory if the result set is large enough.

You have two possible solutions.

1. Best - Make your result set smaller.
2. Set unidirectional to false. There are many things you will not be
able to do - I believe data aware controls will not work. However, you
can create reports and devise your own scroll forward only methodology.

Todor Geshev wrote:
Have TIBQuery with unidirectional=false.
If many times it open and closed by changing only the parameters or open once, but with many records in results it gives "Out of memory"
Thnaks

---
This email has been checked for viruses by AVG.
http://www.avg.com
Attila Molnár

Posts: 7
Registered: 12/2/09
Re: UniDirectional
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 21, 2018 12:09 AM   in response to: quinn wildman in response to: quinn wildman
The real cause of OoM is memory fragmentation, because of the many reallocations, as the dataset grows in client side via fetching.
Reallocations can be avoided if you set BufferChunks (default 1000 record) to the size of the recordset before TIBQuery.Open.

quinn wildman wrote:
If unidirectional is false, then every row you scroll through gets
loaded into memory and scrolling through a large result set is expected
to eventually result in out memory if the result set is large enough.

You have two possible solutions.

1. Best - Make your result set smaller.
2. Set unidirectional to false. There are many things you will not be
able to do - I believe data aware controls will not work. However, you
can create reports and devise your own scroll forward only methodology.

Todor Geshev wrote:
Have TIBQuery with unidirectional=false.
If many times it open and closed by changing only the parameters or open once, but with many records in results it gives "Out of memory"
Thnaks

---
This email has been checked for viruses by AVG.
http://www.avg.com
Todor Geshev

Posts: 14
Registered: 10/1/00
Re: UniDirectional  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 21, 2018 2:04 AM   in response to: Todor Geshev in response to: Todor Geshev
You are both right

And I know that. Just for an experiment I tried to read 1 304 000 records with a length of 300 bytes. My virtual machine has 4GB RAM. Running an IBX project under Delphi could not read them with a variety of BufferChunks. Most read to 1 180 000 and 1.5 GB before it stops with error. I tried with FDQuery and read all the records and taking 512MB of memory. I also tried with data for a whole year ~4 500 000 records and 1.8GB without problem.
Thanks
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: UniDirectional  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 21, 2018 11:39 AM   in response to: Todor Geshev in response to: Todor Geshev
On 3/21/2018 5:04 AM, Todor Geshev wrote:
You are both right

And I know that. Just for an experiment I tried to read 1 304 000 records with a length of 300 bytes. My virtual machine has 4GB RAM. Running an IBX project under Delphi could not read them with a variety of BufferChunks. Most read to 1 180 000 and 1.5 GB before it stops with error. I tried with FDQuery and read all the records and taking 512MB of memory. I also tried with data for a whole year ~4 500 000 records and 1.8GB without problem.
Thanks

IBX's memory manager requires a contiguous piece of memory to whole the whole
results. As it grows it will need current size + current size + (bufferchunks *
record size) to do the reallocation. So as it gets close to the 1M records it
is needing 300M + 303M (606M total) to resize the buffer. Not all the released
memory back to the memory manager will be too small (remember IBX is asking of a
contiguous length of memory) for the next allocation so the MM can't use what it
has and needs more memory from the OS.

When doing this large of a resultset set your buffer chunks >= # of records so
no re-allocations ever happen.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02