Re: libc.lsh
Yann LeCun <[email protected]> Fri, 31 Jul 2009 14:34:47 -0400
| Newsgroups | gmane.lisp.lush.devel |
|---|---|
| Organization | Courant Institute, NYU |
| Message-ID | <[email protected]> |
> On Fri, 31 Jul 2009, Yann LeCun wrote: > > This functionality is still needed, even with the new > > memory management scheme. > > > > For example, if you want to allocate a C struct inside of a Lush > > object, the memory management will be handled by the > > constructor/destructor of the Lush object which will need to call > > malloc and free. > > Right, I agree. And those uses case would not be > problem. Problems would occur when you were trying > to assemble a lush object, or parts of it, using > malloc and expect the runtime/interpreter will accept > it as one of its own. I hope such uses are rare or > absent in legacy code. I can't think of any legacy code that uses that, because I don't think that would have worked in Lush1 either. > I just resurrected libc. Cool. -- Yann > > On Friday 31 July 2009, Ralf Juengling wrote: > >> On Fri, 31 Jul 2009, Yann LeCun wrote: > >>> malloc anf free in libc.lsh were meant to call the > >>> C malloc() and free(), without memory management. > >> > >> Right. > >> > >>> A *lot* of libraries use them. > >>> I'm not sure what the alternative is in Lush2. > >> > >> If you need a managed buffer and don't want to compile > >> you would do > >> > >> (let ((buf (char-array <bufsize>))) > >> .. > >> (foo (idx-base buf)) > >> .. > >> ) > >> > >> to create the buffer and get the address. > >> > >> In compiled code you alternatively may use inline > >> C and mm_blob() if you know what you are doing. > >> Here is documentation for lush's memory manager: > >> http://sourceforge.net/apps/trac/libcmm/wiki/LibDocu > >> > >> If you need an unmanaged buffer and don't want to > >> compile, then you need indeed something like > >> malloc and free as were defined in libc. In compiled > >> code, just use inline C. > >> > >> If we bring libc back, the code that uses malloc and > >> free might compile just fine but still be broken, > >> depending on what you are doing with the memory. > >> That code should be reviewed. > >> > >> I will respond to the constants issue later, > >> Ralf > >> > >>> -- Yann > >>> > >>> On Friday 31 July 2009, Ralf Juengling wrote: > >>>> Some definitions in libc.lsh might be problematic because > >>>> memory management had changed (malloc & free), and most > >>>> others were redundant. @ and @@ as they were defined in > >>>> libc/constants was unecessary, I thought (why limit your > >>>> namespace, especially if there are better ways ?). > >>>> For both situations there are alternatives--just use > >>>> defconstant and #. for read-time evaluation, as in > >>>> common lisp. > >>>> > >>>> I removed those files so that it is clear which files I > >>>> still need to update and what to look for. > >>>> > >>>> Ralf > >>>> > >>>> On Fri, 31 Jul 2009, Yann LeCun wrote: > >>>>> Hi Ralf, > >>>>> > >>>>> Any good reason for not removing libc.lsh and constants.lsh > >>>>> from Lush2 in lsh/libc? > >>>>> > >>>>> SDL and a whole bunch of other packages use them. > >>>>> > >>>>> Is there another to do the same thing on Lush2? > >>>>> > >>>>> -- Yann > >>>>> > >>>>> > >>>>> > >>>>> --------------------------------------------------------------------- > >>>>>-- -- ----- Let Crystal Reports handle the reporting - Free Crystal > >>>>> Reports 2008 30-Day trial. Simplify your report design, integration > >>>>> and deployment - and focus on what you do best, core application > >>>>> coding. Discover what's new with Crystal Reports now. > >>>>> http://p.sf.net/sfu/bobj-july > >>>>> _______________________________________________ > >>>>> Lush-devel mailing list > >>>>> [email protected] > >>>>> https://lists.sourceforge.net/lists/listinfo/lush-devel > >> > >> ------------------------------------------------------------------------ > >>--- --- Let Crystal Reports handle the reporting - Free Crystal Reports > >> 2008 30-Day trial. Simplify your report design, integration and > >> deployment - and focus on what you do best, core application coding. > >> Discover what's new with Crystal Reports now. > >> http://p.sf.net/sfu/bobj-july > >> _______________________________________________ > >> Lush-devel mailing list > >> [email protected] > >> https://lists.sourceforge.net/lists/listinfo/lush-devel > > > > ------------------------------------------------------------------------- > >----- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > > 30-Day trial. Simplify your report design, integration and deployment - > > and focus on what you do best, core application coding. Discover what's > > new with Crystal Reports now. http://p.sf.net/sfu/bobj-july > > _______________________________________________ > > Lush-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/lush-devel > > --------------------------------------------------------------------------- >--- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day trial. Simplify your report design, integration and deployment - and > focus on what you do best, core application coding. Discover what's new > with Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Lush-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/lush-devel ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july