Using this test code, based on my real project:
var test = ko.mapping.fromJS({ id: 1, kids: [{ name: "sue"}] });
test.kids.push({ name: "tim" });
test.kids.push(ko.mapping.fromJS({ name: "joe" }));
console.log(test);
console.log(test.kids()[0]);
console.log(test.kids()[1]);
console.log(test.kids()[2]);
test.kids()[2].__ko_mapping__ = undefined;
console.log(test.kids()[2]);
The console output in Firebug shows:
Object { __ko-mapping__={...}, id=d(), kids=d() }
Object { name=d() }
Object { name="tim" }
Object { __ko-mapping__={...}, name=d() }
Object { name=d() }
My goal is to add items to the kids array after the initial mapping of the data, and have those items look identical to the original items added. If I just push an object directly on the array, the properties are not observables. If I push the object using ko.mapping.fromJS they get an extra __ko_mapping__ object included. I'd rather not have the extra object, as it doesn't seem to be needed (original items don't have it and work fine), and I might use this same design in places where I am adding 1000s of items later.
Setting the object to undefined does seem to remove the extra object, but would rather not have it created in the first place if possible.
__ko_mapping__is created and used by the mapping plug-in on the "root" element whenko.mapping.fromJSis called. You should not care about it and it is not configurable it is added automatically. If you fear of memory problems then you should create a constructor function for your items and use that instead of the mapping plug-in.