Subject Re: [IBO] Large Blob Insertion
Author Geoff Worboys

I am not quite convinced that the problem lies in IBO, but if it does
then we need to isolate it better. To explain what I mean...

If I use a memo control to insert 2Mb of text, IB_ReallocMem is called
once for the entire size required. This happens because the TStrings
class does a direct assignment from stream to stream.

I have not got anything setup, but it appears that when you assign a
stream (rather than TStrings) to a TIB_BlobStream, IBO uses the
TStream CopyFrom method which does use a buffer - but that buffer is
$F000 in size (60k) unless the supplied count is less than that. ie.

if Count > $F000 then
BufSize := $F000
BufSize := Count;

So while using CopyFrom may not be ideal (Jason?) it should not be
giving the results you are seeing at the moment.

> FDataLink.Field.Assign(ILines);

"ILines" - is that a TStringList derivation or a TStream derivation?
I think that it must be a TStream or it could not embed a picture -
although perhaps it converts to hex or base64.

> which causes CreateBlobStream to be called
> which calls TIBOBlobStream.Create
> which calls TIB_BlobStream.Create

The problem here is that I cannot see how the assignment from stream
to stream is achieved. It can go either way.

eg. ControlStream.SaveToStream( IBOStream )
or IBOStream.Stream.LoadFromStream( ControlStream )

Do you see what I mean? If it is the second version then I can see in
the IBO code what is (or should be) happening. If it is the first
version then the actual transfer code may exist in a different stream
class that I dont have the code for.

Can you stick a breakpoint in the ib_reallocmem function and post the
callstack details. (Perhaps run through a couple of calls to ensure
we are looking at the particular/problem allocation.

Geoff Worboys
Telesis Computing