Re: [Rd] optim/vmmin and R_alloc

2004-12-31 Thread Thomas Lumley
On Fri, 31 Dec 2004, [iso-8859-1] Göran Broström wrote: Regarding 2., I tried the combination vmaxget + Calloc + vmaxset, ie, I began my function with vmax = vmaxget() and ended it with vmaxset(vmax). The point with this is that you can free all allocated memory with one call instead of repeated ca

Re: [Rd] optim/vmmin and R_alloc

2004-12-31 Thread Göran Broström
On Thu, Dec 30, 2004 at 02:28:49PM -0800, Thomas Lumley wrote: > On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: > > >On Thu, Dec 30, 2004 at 08:01:41AM -0800, Thomas Lumley wrote: > >>On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: > >>> > >>>However, and that is my question/sugge

Re: [Rd] optim/vmmin and R_alloc

2004-12-30 Thread Thomas Lumley
On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: On Thu, Dec 30, 2004 at 08:01:41AM -0800, Thomas Lumley wrote: On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: However, and that is my question/suggestion: Why not use Calloc+Free instead of R_alloc in vmmin (and maybe in other places)

Re: [Rd] optim/vmmin and R_alloc

2004-12-30 Thread Göran Broström
On Thu, Dec 30, 2004 at 08:01:41AM -0800, Thomas Lumley wrote: > On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: > > > >However, and that is my question/suggestion: Why not use Calloc+Free > >instead of R_alloc in vmmin (and maybe in other places)? I made the > >changes in 'optim.c' in the

Re: [Rd] optim/vmmin and R_alloc

2004-12-30 Thread Göran Broström
On Thu, Dec 30, 2004 at 04:27:59PM +, Prof Brian Ripley wrote: > On Thu, 30 Dec 2004, Thomas Lumley wrote: > > >On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: > >> > >>However, and that is my question/suggestion: Why not use Calloc+Free > >>instead of R_alloc in vmmin (and maybe in ot

Re: [Rd] optim/vmmin and R_alloc

2004-12-30 Thread Prof Brian Ripley
On Thu, 30 Dec 2004, Thomas Lumley wrote: On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: However, and that is my question/suggestion: Why not use Calloc+Free instead of R_alloc in vmmin (and maybe in other places)? I made the changes in 'optim.c' in the functions 'vmmin' and 'Lmatrix'. The

Re: [Rd] optim/vmmin and R_alloc

2004-12-30 Thread Göran Broström
On Thu, Dec 30, 2004 at 08:01:41AM -0800, Thomas Lumley wrote: > On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: > > > >However, and that is my question/suggestion: Why not use Calloc+Free > >instead of R_alloc in vmmin (and maybe in other places)? I made the > >changes in 'optim.c' in the

Re: [Rd] optim/vmmin and R_alloc

2004-12-30 Thread Thomas Lumley
On Thu, 30 Dec 2004, [iso-8859-1] Göran Broström wrote: However, and that is my question/suggestion: Why not use Calloc+Free instead of R_alloc in vmmin (and maybe in other places)? I made the changes in 'optim.c' in the functions 'vmmin' and 'Lmatrix'. Then I rebuilt and reinstalled R-2.0.1. The r

[Rd] optim/vmmin and R_alloc

2004-12-30 Thread Göran Broström
I am calling 'vmmin' several times from a C function (which is called via .C). It works very well, except for memory consumption. The cause is that vmmin allocates memory via R_alloc, and this memory is not freed as vmmin exits. Instead all the allocated memory is freed on return of the .C call.