Talk:Memory allocation: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 7: | Line 7: | ||
I think this task does not apply to [[Tcl]], and suspect it is not applicable to any other dynamic language either. They all leave memory management to their runtime; that's part of their charm. But I won't help them by marking tasks with <nowiki>{{Omit}}</nowiki> for them... —[[User:Dkf|Dkf]] 19:11, 26 May 2009 (UTC) |
I think this task does not apply to [[Tcl]], and suspect it is not applicable to any other dynamic language either. They all leave memory management to their runtime; that's part of their charm. But I won't help them by marking tasks with <nowiki>{{Omit}}</nowiki> for them... —[[User:Dkf|Dkf]] 19:11, 26 May 2009 (UTC) |
||
: I was hoping that even dynamic languages could show how to how to manage lifetimes of blocks of memory, for use in foreign function interfaces, for example. --[[User:IanOsgood|IanOsgood]] 22:18, 26 May 2009 (UTC) |
: I was hoping that even dynamic languages could show how to how to manage lifetimes of blocks of memory, for use in foreign function interfaces, for example. --[[User:IanOsgood|IanOsgood]] 22:18, 26 May 2009 (UTC) |
||
I am not clear on what exactly counts as allocating a "block" of memory. Does it mean you have to explicitly calculate the size of the memory you are allocating? or does allocating an object count? or allocating an array? |
|||
Because if you take the C example codes using malloc() and all, the equivalent way to do the things in C++ would be to use "new" and "new []", e.g. "new int" (allocates space for one int), "new int[10]" (allocates space for 10 ints), "new MyClass" (allocates space for one MyClass object, and initializes it at the same time). Notice that you don't have to manually calculate the sizes -- they are calculated for you from the type. So do these count for this task? Then you can take these a step further -- the last two of them can be translated into Java: "new int[10]" (allocates an array of 10 ints), "new MyClass()" (allocates space for one MyClass object, and initializes it at the same time). Do these Java allocations fall under this task too? --[[User:Spoon!|Spoon!]] 04:57, 27 May 2009 (UTC) |