#1  
Old 17th September 2024, 02:12 AM
NatSam NatSam is offline
Member
 
Join Date: Oct 2010
Location: Brazil
Posts: 47
Default Command to free nxServer memory

There was an error in my application that caused the tables to be opened multiple times and this caused the server to use 3 GB of memory (the tables were just a few kbytes).

After closing the application, this memory was not released on the server and I had to restart nxServer to release this memory.

Is there any way to make nxServer release the memory used by the server (and which is not in use) without having to restart the service?
__________________
Samuel (NatSam)
  #2  
Old 17th September 2024, 09:18 AM
Eivind Bakkestuen
 
Posts: n/a
Default Re: Command to free nxServer memory

> After closing the application, this memory was not released on the
> server and I had to restart nxServer to release this memory.


The description might be incomplete; are we talking about temporary/mem
tables etc? If the exactly same physical tables were opened multiple
times, they would not cause multiple block cache allocations per table.
There would at most be a small allocation per extra table instance.

> Is there any way to make nxServer release the memory used by the
> server (and which is not in use) without having to restart the
> service?


No; the ServerEngine's MaxRAM setting for the block cache can't be
changed while the server is active. The server allocates up to the
maximum set, after which it stays allocated.

--
Eivind Bakkestuen [NDD]
  #3  
Old 18th September 2024, 01:30 AM
NatSam NatSam is offline
Member
 
Join Date: Oct 2010
Location: Brazil
Posts: 47
Default

Quote:
Originally Posted by Eivind Bakkestuen View Post

The description might be incomplete; are we talking about temporary/mem
tables etc? If the exactly same physical tables were opened multiple
times, they would not cause multiple block cache allocations per table.
There would at most be a small allocation per extra table instance.
They were physical tables, opened in a function and at the end of the function they were not being closed and released.

The function looks like:

Function SumValues(...): Double;
var
wTable:=TnxTable;
Begin
wTable:=TNxTable.Create(Self);
wTable.Database:=wSession;
wTable.TableName:='HIP0010A';
wTable.Open;
:
:
:
wTable.Close; ///This line had been deleted incorrectly
wTable.Free; ///This line had been deleted incorrectly
Result:=wSoma;
End;


Quote:
Originally Posted by Eivind Bakkestuen View Post

No; the ServerEngine's MaxRAM setting for the block cache can't be
changed while the server is active. The server allocates up to the
maximum set, after which it stays allocated.
Ok.

It would be nice to have a command to free up memory that is no longer in use by nxServer.

Thank you
__________________
Samuel (NatSam)
  #4  
Old 18th September 2024, 04:45 PM
Thorsten Engler [NDA]
 
Posts: n/a
Default Re: Command to free nxServer memory

That just means that you keep more server side cursor objects open. They will
get freed when the session is closed at the latest. Their memory is at that
point returned to the memory manager. And the memory manager will return
physical memory to the OS when the opportunity presents itself.

Windows memory management is a complex topic, and you are pretty much
guaranteed not to look at the correct values when trying to understand the
memory usage of a windows process.

"Committed memory" is not "physical memory being used". Committed memory just
means the amount is counted against the sum total of phsical memory and swap
size. It says nothing about physical memory usage.

Only once a page of committed memory is first actually being accessed will
windows associate a physical memory page with it and guarantees from that
moment on that it's contents will be available on access (which it might do by
writing the page to the swap file at some point, and when it's later accessed
again, read that page into a new physical page and associate it with that
address).

It's possible to "reset" a page of commited address space. That will not
instantly disassociate the physical memory from that address. Instead it just
marks the page as being available of reclamation when needed. It means that
when windows needs that physical memory elsewhere, it doesn't have to write out
the current contents to the swap file, and can just discard it, on later
access, just providing a new empty page.

If you access the page again before windows needed the memory elsewhere, it
just stays in place and the reset flag is removed. This is much faster than if
the OS has to find a new page.

nxMM is written to take full advantage of these and similar implementation
details of the windows memory system, minimizing the work the OS has to do when
allocating/accessing memory.

You don't need to have to do anything to get nxServer to "free memory it
doesn't need". nxServer will already make sure that any ***physical memory***
it doesn't need is available for the OS to reclaim if it is needed elsewhere.

NatSam wrote:

>
> Eivind Bakkestuen;117359 Wrote:
> >
> > The description might be incomplete; are we talking about temporary/mem
> > tables etc? If the exactly same physical tables were opened multiple
> > times, they would not cause multiple block cache allocations per table.
> > There would at most be a small allocation per extra table instance.
> >

> They were physical tables, opened in a function and at the end of the
> function they were not being closed and released.
>
> The function looks like:
>
> Function SumValues(...): Double;
> var
> wTable:=TnxTable;
> Begin
> wTable:=TNxTable.Create(Self);
> wTable.Database:=wSession;
> wTable.TableName:='HIP0010A';
> wTable.Open;
> :
> :
> :
> wTable.Close; ///This line had been deleted incorrectly
> wTable.Free; ///This line had been deleted incorrectly
> Result:=wSoma;
> End;
>
>
> Eivind Bakkestuen;117359 Wrote:
> >
> > No; the ServerEngine's MaxRAM setting for the block cache can't be
> > changed while the server is active. The server allocates up to the
> > maximum set, after which it stays allocated.

> Ok.
>
> It would be nice to have a command to free up memory that is no longer
> in use by nxServer.
>
> Thank you




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OT: list of collections. How to free memory ? Roberto Nicchi nexusdb.public.discussions 4 8th July 2009 07:38 AM
NxServer as service via command line Martin Radvansky nexusdb.public.discussions 6 28th August 2008 09:54 AM
Are there DOS errorlevels returned from NxServer when installing at command prompt? Jerry Hayes nexusdb.public.support 4 15th June 2007 08:26 AM
Use the free V2.4 embedded, use blob field through datasnap, fastmm will report a memory leak kenter nexusdb.public.support 0 3rd October 2006 01:33 PM
nxServer Memory use Alexandre Morette-Bourny nexusdb.public.support 1 23rd July 2003 10:50 PM


All times are GMT +11. The time now is 04:40 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.