caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* mixed functional / object style
@ 2009-04-18 14:48 Guillaume Hennequin
  2009-04-20  5:34 ` [Caml-list] " Jacques Garrigue
  2009-04-20  6:14 ` Goswin von Brederlow
  0 siblings, 2 replies; 3+ messages in thread
From: Guillaume Hennequin @ 2009-04-18 14:48 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

Dear list,

this is a somewhat naive question
let's define

class a = object
 val mutable v = ...
 method v = v
 method m = something that uses v
end ;;

now assume that I want to create a lot of those a objects, so many that I
may encounter memory problems.

I thought the following would be better, memory wise, but when I test it
doesn't seem to be the case

class a = object
 val mutable v = ...
 method v = v
end ;;

and instead of each object having its own method m, I define it separately
let m x = something that calls x#v

This question is somewhat equivalent to: what is the memory consumption of a
simple method
method m = let _ = self#v in () ??

Thanks a lot
Guillaume.

[-- Attachment #2: Type: text/html, Size: 786 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-20  6:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-18 14:48 mixed functional / object style Guillaume Hennequin
2009-04-20  5:34 ` [Caml-list] " Jacques Garrigue
2009-04-20  6:14 ` Goswin von Brederlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).