Hi guys
We are having some problems with our appservers. They are running out of memory and i suspect my new "search" is the reason.
I have written a small exampel to demonstrate how i search for records. My new Appserver search is called from .NET and looks like this. (just a small exampel).
Can you see anything wrong with this that can cause memory leak ?
We are having some problems with our appservers. They are running out of memory and i suspect my new "search" is the reason.
I have written a small exampel to demonstrate how i search for records. My new Appserver search is called from .NET and looks like this. (just a small exampel).
Code:
/* This is input parameter in my seach. Just added 3 columns to demonstrate */
def var cFields as char init "CustomerName,CustomerAddress,CustomerContact" no-undo.
def var qh as handle no-undo.
def var htt as handle no-undo.
def var hb as handle no-undo.
def var i as int no-undo.
def var xmlCreated as log no-undo.
def var myXML as longchar no-undo.
/* Build a temp-table */
create temp-table htt.
do i = 1 to num-entries(cFields ,','):
htt:add-new-field(entry(i,cFields,','), 'Character').
end.
htt:temp-table-prepare("CustomerSearch":U).
hb = htt:default-buffer-handle.
/* Run query and fill temp-table */
create query qh.
qh:ADD-BUFFER(BUFFER Customer:HANDLE).
qh:query-prepare('for each customer no-lock').
qh:forward-only = true.
qh:query-Open().
qh:get-first().
/* Just get first 100*/
def var iNumAdded as int no-undo.
do while available Customer and iNumAdded lt 100 :
hb:buffer-create().
assign hb::CustomerName = customer.c-name.
assign hb::CustomerAddress= customer.c-address.
assign hb::CustomerContact= customer.c-contact.
assign iNumAdded = iNumAdded + 1.
qh:get-next(no-lock).
end.
/*Create xml-string of temp-table*/
xmlCreated = htt:default-buffer-handle:write-xml("Longchar",myXML,true,?,?,true,false).
/* Close and delete query */
qh:query-close().
delete object qh.
/* Delete temp-table*/
hb:buffer-release().
delete object htt.
/*...returning the myXML search result as an output parameter */
Can you see anything wrong with this that can cause memory leak ?