Memory releasing problem - PBDOM

I have a xml files list and for each one xml file I do some processing
(event ue_process_file). Average file size is 400 kB and after each event
calling occupied memory increases about 10Mb.
Below is the code I use (I do nothing but just parsing XML)

/******* event ue_process_file *******/
long ll_row, ll_ret
string ls_file, ls_error
PBDOM_BUILDER      pbdom_bldr
PBDOM_DOCUMENT     pbdom_doc
PBDOM_Object   pbdom_obj[]

ll_row = dw_sheet.GetRow()
if ll_row <= 0 or ll_row > dw_sheet.RowCount() then return

ls_file = dw_sheet.object.file_name[ll_row]

ll_ret = XMLParseFile(ls_file,ValAuto!,ls_error,False,False,False)
if ll_ret < 0 then
 MessageBox(this.Title,ls_error + " RC= " + string(ll_ret))
 return
end if

TRY
 pbdom_bldr = Create PBDOM_Builder
 pbdom_doc = pbdom_bldr.BuildFromFile(ls_file)
 if isValid(pbdom_doc) then
  IF pbdom_doc.HasChildren() THEN
   IF pbdom_doc.GetContent( pbdom_obj ) THEN
    FOR ll_row = 1 TO UpperBound( pbdom_obj )
     ll_ret = of_process_data(pbdom_obj[ll_row],0,ls_error)
     if ll_ret < 0 then
      destroy pbdom_bldr
      MessageBox(this.Title,ls_error)
      return
     end if
    NEXT
   END IF
  END IF
 end if

 destroy pbdom_bldr

CATCH (PBDOM_Exception except)
   MessageBox (this.Title, "PBDOM exception: " + except.Text)
CATCH ( PBXRuntimeError re )
 MessageBox( this.Title, "PBNI exception: " + re.getMessage() )
END TRY


/******** of_process_data *********/
long ll_ret = 1
PBDOM_object data[]
string ls_element

TRY
 IF pbd_object.haschildren( ) THEN
  pbd_object.GetContent( data )
  Long   ll_index, ll_count
  ll_count = UpperBound( data )
  FOR ll_index = 1 TO ll_count
   ll_ret = this.of_Process_Data( data[ll_index], al_level + 1, as_error)
   if ll_ret < 0 then return -1
  NEXT
 END IF
CATCH ( PBDOM_Exception pbde )
 as_error = "***PBDOM Exception*** - " + pbde.getMessage()
 return -1
CATCH ( PBXRuntimeError re )
 as_error = "***PBNI Exception*** - " + re.getMessage()
 return -1
END TRY

return ll_ret

--
Miroslaw Gasiorek
mirekg@skg.pl


0
Miroslaw
5/20/2003 8:00:30 AM
sybase.powerbuilder.xml 546 articles. 0 followers. Follow

6 Replies
488 Views

Similar Articles

[PageSpeed] 24

What exactly are you processing? All I see is looping through the DOM
tree -- remember that the DOM implementation is very memory intensive (it
loads the entire document into memory). If you have 10 400K documents,
you'll have 4MB of memory occupied (not taking PB storage into account -- 
that's just the underlying Xerces parser).

Can you provide some more details on what the actual processinf does?

-- 
<hopethishelps/>
Roy Kiesler [TeamSybase]
SDN CodeXchange -- http://codexchange.sybase.com

"Miroslaw Gasiorek" <mirekg@skg.pl> wrote in message
news:%23g2IObqHDHA.213@forums-1-dub...
> I have a xml files list and for each one xml file I do some processing
> (event ue_process_file). Average file size is 400 kB and after each event
> calling occupied memory increases about 10Mb.
> Below is the code I use (I do nothing but just parsing XML)
>
> /******* event ue_process_file *******/
> long ll_row, ll_ret
> string ls_file, ls_error
> PBDOM_BUILDER      pbdom_bldr
> PBDOM_DOCUMENT     pbdom_doc
> PBDOM_Object   pbdom_obj[]
>
> ll_row = dw_sheet.GetRow()
> if ll_row <= 0 or ll_row > dw_sheet.RowCount() then return
>
> ls_file = dw_sheet.object.file_name[ll_row]
>
> ll_ret = XMLParseFile(ls_file,ValAuto!,ls_error,False,False,False)
> if ll_ret < 0 then
>  MessageBox(this.Title,ls_error + " RC= " + string(ll_ret))
>  return
> end if
>
> TRY
>  pbdom_bldr = Create PBDOM_Builder
>  pbdom_doc = pbdom_bldr.BuildFromFile(ls_file)
>  if isValid(pbdom_doc) then
>   IF pbdom_doc.HasChildren() THEN
>    IF pbdom_doc.GetContent( pbdom_obj ) THEN
>     FOR ll_row = 1 TO UpperBound( pbdom_obj )
>      ll_ret = of_process_data(pbdom_obj[ll_row],0,ls_error)
>      if ll_ret < 0 then
>       destroy pbdom_bldr
>       MessageBox(this.Title,ls_error)
>       return
>      end if
>     NEXT
>    END IF
>   END IF
>  end if
>
>  destroy pbdom_bldr
>
> CATCH (PBDOM_Exception except)
>    MessageBox (this.Title, "PBDOM exception: " + except.Text)
> CATCH ( PBXRuntimeError re )
>  MessageBox( this.Title, "PBNI exception: " + re.getMessage() )
> END TRY
>
>
> /******** of_process_data *********/
> long ll_ret = 1
> PBDOM_object data[]
> string ls_element
>
> TRY
>  IF pbd_object.haschildren( ) THEN
>   pbd_object.GetContent( data )
>   Long   ll_index, ll_count
>   ll_count = UpperBound( data )
>   FOR ll_index = 1 TO ll_count
>    ll_ret = this.of_Process_Data( data[ll_index], al_level + 1, as_error)
>    if ll_ret < 0 then return -1
>   NEXT
>  END IF
> CATCH ( PBDOM_Exception pbde )
>  as_error = "***PBDOM Exception*** - " + pbde.getMessage()
>  return -1
> CATCH ( PBXRuntimeError re )
>  as_error = "***PBNI Exception*** - " + re.getMessage()
>  return -1
> END TRY
>
> return ll_ret
>
> --
> Miroslaw Gasiorek
> mirekg@skg.pl
>
>


0
Roy
5/20/2003 1:25:25 PM
To diagnose problem I deleted all code for reading nodes and attributes and
I left just looping through the tree. I process document after document (I
call my event for a document choosen from list) so after each one document
memory should be released. Occupied memeory increases also when I call my
event several times for the one XML file. My PB Version is 9.0 Build 6053

U�ytkownik "Roy Kiesler [TeamSybase]" <SPAM_FREE_roy.kiesler@teamsybase.com>
napisa� w wiadomo�ci news:OdJyBPtHDHA.212@forums-1-dub...
> What exactly are you processing? All I see is looping through the DOM
> tree -- remember that the DOM implementation is very memory intensive (it
> loads the entire document into memory). If you have 10 400K documents,
> you'll have 4MB of memory occupied (not taking PB storage into account --
> that's just the underlying Xerces parser).
>
> Can you provide some more details on what the actual processinf does?
>
> --
> <hopethishelps/>
> Roy Kiesler [TeamSybase]
> SDN CodeXchange -- http://codexchange.sybase.com



0
Miroslaw
5/20/2003 1:51:03 PM
If you are processing in tight loops, GC may not have enough time to kick
into action -- have you tried 'helping' it by setting PBDOM objects to NULL
in a FINALLY block?

If that does not help, submit a case via CaseExpress (attach the files
you're working with)

-- 
<hopethishelps/>
Roy Kiesler [TeamSybase]
SDN CodeXchange -- http://codexchange.sybase.com

"Miroslaw Gasiorek" <mirekg@skg.pl> wrote in message
news:ODBLFftHDHA.330@forums-1-dub...
> To diagnose problem I deleted all code for reading nodes and attributes
and
> I left just looping through the tree. I process document after document (I
> call my event for a document choosen from list) so after each one document
> memory should be released. Occupied memeory increases also when I call my
> event several times for the one XML file. My PB Version is 9.0 Build 6053
>
> U�ytkownik "Roy Kiesler [TeamSybase]"
<SPAM_FREE_roy.kiesler@teamsybase.com>
> napisa� w wiadomo�ci news:OdJyBPtHDHA.212@forums-1-dub...
> > What exactly are you processing? All I see is looping through the DOM
> > tree -- remember that the DOM implementation is very memory intensive
(it
> > loads the entire document into memory). If you have 10 400K documents,
> > you'll have 4MB of memory occupied (not taking PB storage into
account --
> > that's just the underlying Xerces parser).
> >
> > Can you provide some more details on what the actual processinf does?
> >
> > --
> > <hopethishelps/>
> > Roy Kiesler [TeamSybase]
> > SDN CodeXchange -- http://codexchange.sybase.com
>
>
>


0
Roy
5/20/2003 3:57:40 PM
I tried it, I even called GarbageCollect() in script but all without effect.
Memory stayes occupied by PBDOM till closing PB.

U�ytkownik "Roy Kiesler [TeamSybase]" <SPAM_FREE_roy.kiesler@teamsybase.com>
napisa� w wiadomo�ci news:#SisGkuHDHA.334@forums-1-dub...
> If you are processing in tight loops, GC may not have enough time to kick
> into action -- have you tried 'helping' it by setting PBDOM objects to
NULL
> in a FINALLY block?
>
> If that does not help, submit a case via CaseExpress (attach the files
> you're working with)
>
> --
> <hopethishelps/>
> Roy Kiesler [TeamSybase]



0
Miroslaw
5/21/2003 12:42:31 PM
Open a case via CaseExpress -- remember to submit a reproducable (shouldn't
be hard)

-- 
<hopethishelps/>
Roy Kiesler [TeamSybase]
SDN CodeXchange -- http://codexchange.sybase.com

"Miroslaw Gasiorek" <mirekg@skg.pl> wrote in message
news:eQBFgd5HDHA.219@forums-1-dub...
> I tried it, I even called GarbageCollect() in script but all without
effect.
> Memory stayes occupied by PBDOM till closing PB.
>
> U�ytkownik "Roy Kiesler [TeamSybase]"
<SPAM_FREE_roy.kiesler@teamsybase.com>
> napisa� w wiadomo�ci news:#SisGkuHDHA.334@forums-1-dub...
> > If you are processing in tight loops, GC may not have enough time to
kick
> > into action -- have you tried 'helping' it by setting PBDOM objects to
> NULL
> > in a FINALLY block?
> >
> > If that does not help, submit a case via CaseExpress (attach the files
> > you're working with)
> >
> > --
> > <hopethishelps/>
> > Roy Kiesler [TeamSybase]
>
>
>


0
Roy
5/21/2003 9:46:46 PM
I found the reason !!!
It is using pbdom_doc.GetContent() after loadning XML. You should use
pbdom_doc.GetRootElement().GetContent() instead. I don't know if it's a bug
in this function or it should not be used to read root element. If it's not
a bug Sybase should change help files, I took sample code from HTML books ->
Application Techniques.
The piece for processing XML in ue_process_file event should be as follows:

 TRY
  pbdom_bldr = Create PBDOM_Builder
  pbdom_doc = pbdom_bldr.BuildFromFile(ls_file)
  if isValid(pbdom_doc) then
   IF pbdom_doc.GetRootElement().HasChildren() THEN
    IF pbdom_doc.GetRootElement().GetContent( pbdom_obj ) THEN
     FOR ll_row = 1 TO UpperBound( pbdom_obj )
      ll_ret = of_process_data(pbdom_obj[ll_row],0,ls_error)
      if ll_ret < 0 then
       destroy pbdom_bldr
       MessageBox(this.Title,ls_error)
       return
      end if
     NEXT
    END IF
   END IF
  end if

> I have a xml files list and for each one xml file I do some processing
> (event ue_process_file). Average file size is 400 kB and after each event
> calling occupied memory increases about 10Mb.
> Below is the code I use (I do nothing but just parsing XML)
>
> /******* event ue_process_file *******/
> long ll_row, ll_ret
> string ls_file, ls_error
> PBDOM_BUILDER      pbdom_bldr
> PBDOM_DOCUMENT     pbdom_doc
> PBDOM_Object   pbdom_obj[]
>
> ll_row = dw_sheet.GetRow()
> if ll_row <= 0 or ll_row > dw_sheet.RowCount() then return
>
> ls_file = dw_sheet.object.file_name[ll_row]
>
> ll_ret = XMLParseFile(ls_file,ValAuto!,ls_error,False,False,False)
> if ll_ret < 0 then
>  MessageBox(this.Title,ls_error + " RC= " + string(ll_ret))
>  return
> end if
>
> TRY
>  pbdom_bldr = Create PBDOM_Builder
>  pbdom_doc = pbdom_bldr.BuildFromFile(ls_file)
>  if isValid(pbdom_doc) then
>   IF pbdom_doc.HasChildren() THEN
>    IF pbdom_doc.GetContent( pbdom_obj ) THEN
>     FOR ll_row = 1 TO UpperBound( pbdom_obj )
>      ll_ret = of_process_data(pbdom_obj[ll_row],0,ls_error)
>      if ll_ret < 0 then
>       destroy pbdom_bldr
>       MessageBox(this.Title,ls_error)
>       return
>      end if
>     NEXT
>    END IF
>   END IF
>  end if
>
>  destroy pbdom_bldr
>
> CATCH (PBDOM_Exception except)
>    MessageBox (this.Title, "PBDOM exception: " + except.Text)
> CATCH ( PBXRuntimeError re )
>  MessageBox( this.Title, "PBNI exception: " + re.getMessage() )
> END TRY
>
>
> /******** of_process_data *********/
> long ll_ret = 1
> PBDOM_object data[]
> string ls_element
>
> TRY
>  IF pbd_object.haschildren( ) THEN
>   pbd_object.GetContent( data )
>   Long   ll_index, ll_count
>   ll_count = UpperBound( data )
>   FOR ll_index = 1 TO ll_count
>    ll_ret = this.of_Process_Data( data[ll_index], al_level + 1, as_error)
>    if ll_ret < 0 then return -1
>   NEXT
>  END IF
> CATCH ( PBDOM_Exception pbde )
>  as_error = "***PBDOM Exception*** - " + pbde.getMessage()
>  return -1
> CATCH ( PBXRuntimeError re )
>  as_error = "***PBNI Exception*** - " + re.getMessage()
>  return -1
> END TRY
>
> return ll_ret
>
> --
> Miroslaw Gasiorek
> mirekg@skg.pl
>
>


0
Miroslaw
5/22/2003 9:08:23 AM
Reply:

Similar Artilces:

XML problem..problem..
Hi frinds,. I have a question here.. My quesitos is...and my code is here.. Group_id = ws.webmethod1(session_id, txtgroupname.Text.ToString()); int usergroup = ws.webmethod2(session_id, User_id,Convert.ToInt32(Group_id));  here Group_id is a string that means I am getting like XML formate ( ex : <group> <id>2</id></group> <name> <description> ....................................................</des></name>/..) this is a string... from that I need only group id.. to assing in next step.. in usrgroup.. so before that I need to extr...

Latest release has memory problems.
Name: Bryan Fullerton Email: consakaatblack-ridgedotcom Product: Firefox Summary: Latest release has memory problems. Comments: under windows task manager, firefox keeps building then dropping the page file usage. I am not sure if relative poor performance is resulting from this constant paging process or not but it is definitly slower then the previous 2 releases. I have up to 16 tabs of "www.the-west.net" up on a regular basis and currently it is hosed and is rediculously slow. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.5) Gecko/20...

Problem on releasing Recordset Memory
Hi, all. I am using ASA 7.0 and the ODBC version is 7.00.02.1402. My application is created with VB. One connection will be created and keep connecting with the server. A recordset will be created and destroyed every minute. But rs.close set rs = nothing does not kill the recordset and release memory. So after one day, all memory will be eaten up and hanging up the machine. Please help me. Thanks DBCon.open "Provider=ASAProv;Password=;User ID=;Data Source=DSN;Persist Security Info=True" rs.open "select * from Table_New", DBCon, adopenstati...

*FMT* To release memory in PowerBuilder
I have a small problem with the memory that uses my application. When I often open and I close certain windows, I observe that the used memory is increasing instead of staying stable. These windows contain Datastore objects that are created and destroyed in run time. When it is executed a Destroy is necessary to use the Reset() function before to make sure that the memory is freed? Thank you very much No, a reset of a DS is not necessary before a destroy. Actually under 'normal' circumstances you won't even need to do the destroy of the DS yourself (from PB ...

PowerBuilder 8.03 memory problem
Using PowerBuilder 8.03 when I change the source code for a certain function, the IDE crashes and gives error: 'referenced memory at "0x00000000." The memory could not be "read".' I noticed that the heap manager was changed for this version so I went back to 8.02 and it works fine. Does anyone know a better solution? Thanks, Bob Does the function have a lot of arguments (twenty-ish or more?). There's an open bug out there, if that's the case. BTW, if you have so many arguments, why not just pass them in a structure? rkelty@umich.edu wr...

Problem in Maintaining the XML in the memory--Urgent
Hi,   I am having a problem with reading a soap request. Exact requirement is as below. I am calling three web services and these three webservices are giving the soap response. Now the thing is i want to store these 3 XML files in dataset(anything, But i don't want to store it in the physical memory) and will transform these three soap responses into requires XML formats using XSLTransformation. But these three result xml files also should not be stored in the physical memory and i want to compare these three files from the memory only. Can anybody help me inthis issue.Don...

Memory reference problem and PowerBuilder crash
This problem happened when I was viewing a report. When I click and hold the left mouse button on the scroll bar and attempt to scroll quickly to the bottom of a long report, PowerBuilder crashes and gives me this error: "The Instruction at "0x105d58fe" referenced memory at "0x00000000". The memory could not be "read". Click on OK to terminate the application Click on CANCEL to debug the application" PowerBuilder crashes if I press OK or CANCEL I am running a DELL 700 with PowerBuilder 6.0 Build 419 on NT4.0 SP6. Thanks Robi...

WebControls &amp; XML problem: cannot load data from xml file (i think that is the problem...)
Hi all i'll expose my problem. i have installed framework 1.1 and the SDK and it didn't work. I have uninstalled them and reinstalled 1.0 versions. i have downloaded the WebControls installation file and run it, i have build the Microsoft.Web.UI.WebControls.dll and located in a "bin" folder in my folder application (wwwroot/sampleapp/) and i have placed the webctrl_client folder in my wwwroot folder (i have also tried to duplicate that folder EVERYWHERE in my harddisk catched by sadness!!! O_o). Then i have done the following aspx page: ******************************...

Problem releasing memory from dynamic arrays [Edit]
It seems that a dynamic array will not release memory correctly for multi-dimensional arrays, and it releases no memory for EOutOfMemory exceptions. I’ve included the complete code below, but here is a summary. First note that this is how I’m checking memory usage, which needs PsAPI in the uses code: // From Delphi.about.com, Zarko Gajic function CurrentMemoryUsage: Cardinal; var pmc: TProcessMemoryCounters; begin pmc.cb := SizeOf(pmc) ; if GetProcessMemoryInfo(GetCurrentProcess, @pmc, SizeOf(pmc)) then Result := pmc.WorkingSetSize else RaiseLastOSError; end; The ar...

Releasing memory / memory leaks
I was always under the impression that when developing in ASP.Net you don't need to worry about releasing memory i.e. in your pages/functions/subs you can create as many variables/objects as you want, use them and then 'walk away' and let asp clear up the mess - but after doing some browsing on the web there are a number of people who do not this this is the case. Can anyone give me a definative answer on this.  i.e. if i have something like this at the top of my proc :  dim mObj as new MyClass do i have to put mObj = nothing at the end. What about things like colle...

memory problem with powerbuilder 6.5.1
Hi, I use powerbuilder 6.5.1, Oracle 8.0.5 and when i close my application, i have always a memory problem but i don't find the problem if someone have an idea ? thanks Cyril Caillaud What's the error? -- Terry Dykstra (TeamSybase) Canadian Forest Oil Ltd. Cyril Caillaud wrote in message ... >Hi, > >I use powerbuilder 6.5.1, Oracle 8.0.5 and when i close my application, i >have always a memory problem but i don't find the problem > >if someone have an idea ? > >thanks > >Cyril Caillaud > > which oracle...

memory, memory, memory
Name: bruce Email: bruceatlmcsoftwaredotcom Product: Firefox Summary: memory, memory, memory Comments: Hi, I run firefox all day like I run Outlook. I open/close a zillion tabs using a single instance of firefox, usually no more than 6 tabs at a time. But I've had 20 tabs open at once while I'm culling the NY Times articles I want to print. Every so often my mouse stops moving. Taskmgr shows firefox has 256 Megs of memory (or something equally large) and is using 95% of the cpu. Why?? Make this nonsense stop! Forget the IE/Firefox/Chrome competition. T...

Problems, problems, problems
Name: Product: Firefox Summary: Problems, problems, problems Comments: I use FF all the time for work - I'm a software tester - the add-ons are invaluable. But v3.5 really has been a disappointment. It just keeps hanging all the time. And when Internet Explorer windows pop up, FF often just dies. It can't even restart itself - I have to manually kill the process every time; every update, every add-on that updates, "restart" fails - it's so frustrating. I hope v3.6 will be addressing this - PLEASE! Browser Details: Mozilla/4.0 (compatible; MSIE 7....

PROBLEMS, PROBLEMS, PROBLEMS.
Name: Product: Firefox Summary: PROBLEMS, PROBLEMS, PROBLEMS. Comments: Does Google's Chrome browser block out Firefox? Am having a lot of trouble getting Firefox to run after I run Chrome. No trouble what-so- ever before running Chrome. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1064 Safari/532.5 From URL: http://hendrix.mozilla.org/ Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see ...

Problems, problems, problems
Name: Hans Halvorsen Email: capricorn_at_online.no Product: Thunderbird Summary: Problems, problems, problems Comments: Hi, I downloaded Thunderbird some time ago, and I was over-satisfied whit it and how well it worked. In fact it worked 100% PERFECTLY UNTIL I got an newer update version of it. Since then I' ve had nothing BUT trouble! I've checked adresses, notes, password, deleted accounts and made new one's, checked sign-ins and sign-outs, passwords inside and out, upside and down, so many times that my frustration now is about to turn into pure and major ...

Web resources about - Memory releasing problem - PBDOM - sybase.powerbuilder.xml

Strand Releasing - Wikipedia, the free encyclopedia
Strand Releasing is a theatrical distribution company founded in 1989 and is based in Culver City, California . The company has distributed over ...

10 tips for releasing your Facebook application, and maximizing growth
So, you’ve got a great new facebook app, and you’re salivating at the prospect of unchecked viral growth? Well, who isn’t. Here’s a few tips ...

Releasing fish - Flickr - Photo Sharing!
When releasing a fish, remove the hook, wet your hands, grip the fish just above the tail fin and gently push it forward and backward in the ...

UGLY - Theatrical Trailer - Anurag Kashyap - Ronit Roy - Releasing 26th December 2014 - YouTube
'Ugly' is a dark psychological thriller on the surface and an emotional drama within... Take a look at the much-awaited theatrical trailer of ...

From Bang Bang to Mary Kom and Haider, Bollywood is releasing a slew of blockbusters in the coming months ...
Liked Salman Khan's Kick? Then brace yourself for other high-octane action movies due out this year.

Privacy advocates try to stop Mattel releasing 'creepy' Barbie which records what children say
Privacy advocates are trying to stop Mattel from releasing "creepy" Hello Barbie.


Nuclear waste dumps: Abbott government close to releasing shortlist of possible sites
The Abbott government is close&nbsp;to releasing a&nbsp;shortlist of possible&nbsp;sites to host a nuclear waste dump, but has missed a self ...

Peter Greste: Egypt releasing and deporting jailed Australian journalist, officials say
JAILED Australian journalist Peter Greste has been freed from an Egyptian prison and is on his way home.

Are the Kardashians releasing music?
IN true Kardashians style, the famous sisters have recorded a kitschy music video for their mother’s 60th birthday.

Resources last updated: 12/5/2015 5:35:46 PM