lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


hello Philipp
 
Many thanks,  that was indeed the problem, I have added that line and it reports a figure back down into the 90 kb region.
 
The annoying part was, I had sort of realised I needed to do that and had put this wrong line in
 
package.loaded.language = nil  
 
instead of package.loaded.frenchBig = nil

Of course it made no difference, so I commented it out and didn't mention it in my mail.

Thanks once again 
 
Regards Geoff
 
 
> To: lua-l@lists.lua.org
> From: siffiejoe@gmx.net
> Date: Wed, 9 Oct 2013 23:01:39 +0200
> Subject: Re: Misunderstanding mem allocation and require files
>
> Am 09.10.2013 22:43 schröbte Geoff Smith:
> > Hi
> >
>
> Hi!
>
> >
> > language = nil -- I was expecting this to free most of my memory
> >
> > collectgarbage("collect")
> >
> > So that big table in the require file is likely not being freed totally by the garbage collection. I don't understand why that is happening
> >
> > Any thoughts or explanation would be appreciated
>
> The value returned by a call to `require` is cached in the
> `package.loaded` table (or `debug.getregistry()._LOADED`, which is the
> same table), so that a second call to `require` doesn't have to load the
> Lua module again. You can do
>
> language = nil
> package.loaded.frenchBig = nil
> collectgarbage("collect")
>
> if you really want to get rid of the frenchBig data. `dofile` doesn't do
> any caching, so
>
> dofile( assert( package.searchpath( "frenchBig", package.path ) ) )
>
> would be an alternative to `require` if you don't want caching at all ...
>
> >
> > Thanks
> >
> > Geoff
> >
>
> HTH,
> Philipp
>
>
>
>
>